Home ArduinoB4R A look at B4R and Arduino development

A look at B4R and Arduino development

B4R is a development tool that I had not heard of before until today, it is from the makers of basic4Android a development tool that I have heard of.

You download the tool from https://www.b4x.com/b4r.html where they explain the requirements which are Arduino 1.8+ must be installed on your development PC, after you install B4R you setup the path to the Arduino IDE and this is so that they can use the Arduino tools that are installed for compiling and programming.

You may have guessed that this is programming in basic rather than C++ but this is not anything to do difficult to get to grips with, there are a number of tutorials and code examples on the website and also guides to help you out.

Here is my configuration

B4R configuration

B4R configuration

Now connect your Arduino and open the board selector and choose the options required, here is my Arduino board connected

B4R board selector

B4R board selector

 

The most obvious test is the blink led example

[codesyntax lang=”qbasic”]

Sub Process_Globals
   Public Serial1 As Serial
   Private Timer1 As Timer
   Private pin13 As Pin
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   pin13.Initialize(13, pin13.MODE_OUTPUT)
   Timer1.Initialize("Timer1_Tick", 1000) '1000ms = 1 second
   Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick
   Dim currentState As Boolean = pin13.DigitalRead
   Log("CurrentState: ", currentState)
   Dim NewState As Boolean = Not(currentState)
   Log("NewState: ", NewState)
   pin13.DigitalWrite(NewState)
End Sub

[/codesyntax]

Compile and run this and the on board LED should flash on and off

We will bringing more examples using this development tool

 

You may also like