Red LED and two buttons

coslad

Well-Known Member
Licensed User
Longtime User
Hi ,i program Arduino in C . Arduino has low memory, i love Erel's work but i think that programmig Arduino in basic language reduces the available "program memory"
 

Cableguy

Expert
Licensed User
Longtime User
Hi ,i program Arduino in C . Arduino has low memory, i love Erel's work but i think that programmig Arduino in basic language reduces the available "program memory"
In all B4X products, The end result is a converted NATIVE code version of the B4x app, so I expect that B4R will produce C converted versions, thus making its footprint as similar as possible to any equivalent C created code
 

Toley

Active Member
Licensed User
Longtime User
Erel will never stop surprising us. I think it could be usefull for someone who don't know and don't want to learn C. But Arduino is a so big world with so many libraries, shields and example codes, I think it will not be possible for another language to be as efficient as C.
 

Beja

Expert
Licensed User
Longtime User
B4X:
[code]
pin13.Write(Not(pin13.Read))

Hi Erel,
I thought it's pin13.Write(Not(pin13.Write)), because logically Write is already NOT Read, unless I am missing something.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Hi Erel,
I thought it's pin13.Write(Not(pin13.Write)), because logically Write is already NOT Read, unless I am missing something.
pin13.Write(Not(pin13.Read)) is equivalent to:
B4X:
Dim state As Boolean = pin13.Read
If state = true Then pin13.Write(false) Else pin13.Write(true)
This causes the led to toggle its state.
 

max123

Well-Known Member
Licensed User
Longtime User
I use Arduino and ESP8266 compatible with Arduino IDE, this is a great idea Erel.

I've already developed some code around this using B4J, but it send/receive commands over Wifi
using UDP protocol, is not a language develop tool, just a class that control remotely Arduino pins and
retrieve a value if pins are changed state (like buttons). But no yet finished.

ESP8266 have integrated Wifi, but Arduino require WiFi Shield.

But in your idea how to use jar file? Read it on SDCARD?

Your idea is very cool. :D
Many thanks, i wait this.....
 

Beja

Expert
Licensed User
Longtime User
pin13.Write(Not(pin13.Read)) is equivalent to:
B4X:
Dim state As Boolean = pin13.Read
If state = true Then pin13.Write(false) Else pin13.Write(true)
This causes the led to toggle its state.

Yep!
I realized that after sending the reply.. it is also equivalent to (pseudo code: pin13.output = NOT(pin13.read)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Tree Sort example:
B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Type TreeNode (Value As Int, Left As TreeNode, Right As TreeNode)
   Private nodes(50) As TreeNode
   Private nodesIndex As Byte
   Private rootNode As TreeNode
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   For i = 0 To nodes.Length - 1
     AddNode(Rnd(0, 5000))
   Next
   PrintNode(rootNode)
End Sub

Private Sub AddNode(value As Int)
   Dim n As TreeNode = nodes(nodesIndex)
   nodesIndex = nodesIndex + 1
   n.Value = value
   If rootNode = Null Then
     rootNode = n
   Else
     InsertNode(rootNode, n)
   End If
End Sub

Private Sub PrintNode(n As TreeNode)
   If n.Left <> Null Then PrintNode(n.Left)
   Log("Node: ", n.Value)
   If n.Right <> Null Then PrintNode(n.Right)
End Sub

Private Sub InsertNode(Parent As TreeNode, NewNode As TreeNode)
   If NewNode.Value > Parent.Value Then
     If Parent.Right <> Null Then
       InsertNode(Parent.Right, NewNode)
     Else
       Parent.Right = NewNode
     End If
   Else
     If Parent.Left <> Null Then
       InsertNode(Parent.Left, NewNode)
     Else
       Parent.Left = NewNode
     End If
   End If
End Sub

SS-2016-03-24_17.04.42.png


Unlike the previous code I posted which was only a design prototype this time this is the actual program that was compiled and ran.
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
koff koff...

Libraries will be written in C++.

i have to communicate with a non arduino - specialized Camera that has its libraries in C++, would it be possible to create a program for it with B4R?

Thanks!
 

rbghongade

Active Member
Licensed User
Longtime User
Erel,
The concept looks fantastic! I can hardly wait to try the B4R IDE. Certainly shall open up new way of programming Arduino for BASIC lovers like me!
Great idea.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
i have to communicate with a non arduino - specialized Camera that has its libraries in C++, would it be possible to create a program for it with B4R?
No. B4R programs will only run on Arduino (it is possible that in the future other microcontrollers will be supported).

When we can have the alpha/beta version?
There is still quite a lot of work ahead. It will take some time.
 

Jaames

Active Member
Licensed User
Longtime User
it is possible that in the future other microcontrollers will be supported
Like a Microchip PICs ? I was attending to ask would it be possible maybe in future to ad them as well , but I thought,
that would be too much to ask :)

I hope that PICs will be supported, at least those with usb built in . I have bunch of them, 8-bit like a PIC16F88, PIC16F628, PIC18F2550(usb built in)...
I'm using almost always PicBasic to program them, but I'm sure that B4R would be much superior . If that day comes, I have troubles no more :D ..
 
Top