B4R Tutorials

Blink Example

A simple example that uses a Timer to change the state of pin 13 (this is the pin connected to the built-in led):
B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Private Timer1 As Timer...
 

Memory, Variables and Objects

Memory is a big issue in Arduino.

1. The available RAM is very small compared to other platforms. For example the Uno has 2k of RAM.
2. There is no sophisticated heap management which means that...
 
Last edited:

How to write a Tutorial/Snippets/ShareYourCreations

Hi guys,

I know I am not the most prolific B4R user, but I'm proud to have been the first to post on the "Share Your Creations" of this sub-Forum.
The mentioned sub-Forums have become more and...
 
Last edited:

Strings and Bytes

B4R strings are different than in other B4X tools. The reasons for these differences are:
1. Very limited memory.
2. Lack of Unicode encoders.

A String object in B4R is the same as C char*...
 
Last edited:

[Tool]LCD Display Designer

Tool to design LCD Display Layouts for 20x4 or 16x2 displays connected to Arduino, Raspberry Pi or other.

1613395535658.png

Screenshot application with generated B4R code and an Arduino UNO with...
 

Attachments

  • rLiquidCrystal_I2C-110.zip
    23.3 KB · Views: 489
  • lcddisplaydesigner.zip
    6.6 KB · Views: 488
Last edited:

Connecting two Arduinos with rWire library

SS-2016-04-12_16.46.55.png


The rWire supports communication with other I2C/TWI devices.

One device acts as the master and the other devices act as...
 

Timers, Loopers and CallSubPlus

Arduino C example #1:
B4X:
void setup() {
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the...
 
Last edited:

RGB Leds

RGB Leds are equivalent to three leds (red, green and blue) combined. This allows mixing the three colors which results in many different colors.

There are two types of RGB leds: common cathode...
 
Last edited:

Full responsive ESP8266 settings WebApp with websockets

Merry Christmass everyone in the Christian community of this forum,

Yesterday I 've had a great crazy idea which turned out to be a working one too.

Normally one would answer to the question if...
 

Attachments

  • B4RWebApp.zip
    5 KB · Views: 499
  • B4RWebServer.zip
    2.8 KB · Views: 515
Last edited:

SD cards

The rSD library allows reading and writing to SD cards. The Ethernet shield as well as other shields include a SD slot.

The steps required to work with files:
1. Initialize a SD object. You need...
 

Attachments

  • B4J_PrepareCurrencyFile.zip
    2.8 KB · Views: 926
  • SD_Example.zip
    1.1 KB · Views: 1,150

tone() function

Here is a tone function that does Arduino's tone()
The buzzer is connected between pin 6 and ground :
B4X:
Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    Delay( 1000)...
 
Last edited:

Getting local date & time (easy and free)

I saw a post or two about how to get the local date & time with no easy answers. I need this myself for my first Arduino project so I had a look around and found a free API that does just this...
 

Arduino Simulator

Hey everybody,

Just found this and looks very impressive...

 

EasyEDA - PCB Design CAD

Hi everybody,

looking for free PCB design software I came accross the EasyEDA. It is one of the best I have seen since you get to design multilayered PCBs and see the designed PCB in 3d view...
 
Last edited:

B4R & B4J MQTT display DHT11 sensor data Google Line Chart

Hi,

as an example build a B4R & B4J solution to display DHT11 sensor data (Temperature & Humidity) in a google line chart created and refreshed by a B4J webserver.

Update 2016.05.24
There...
 

Attachments

  • B4RHowToDHT11MQTTGoogleChart.zip
    29.2 KB · Views: 752
Last edited:

Connecting two ESP8266 boards

In this example one of the boards acts as an access point and a server and the other board connects to the server wifi network and to the server socket.

Note that for the client to be able to...
 

ESP8266 FTP Client

Attachments

  • FTPClient.zip
    3.7 KB · Views: 1,758

Custom character creation for LCD

I just found this and it looks very promissing:

 

Http requests with GSM shield

This example shows how to send http requests with a GSM shield. I've tested it on a shield with SIM900 module. This can be very interesting for outdoor IoT solutions where there is no local...
 

Attachments

  • GSMPushMessages.zip
    3.3 KB · Views: 1,211
Last edited:

Visualizing MPU6050 Accelerometer and Gyroscope - Pitch, Roll and Yaw with inline C and Processing

It is based on this tutorial. Nano programmed via B4R and visualizing the data from the MPU6050 with Processing -
See this posting for basic setup

B4R code:...
 

Attachments

  • mpu6050.zip
    983 bytes · Views: 517
  • b4rMPU6050InlineC.b4r.zip
    2.8 KB · Views: 504
Top