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

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

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

We will bringing more examples using this development tool