B4R Tutorials

ESP8266 - Getting Started

B4R v1.20 added support for ESP8266 modules. ESP8266 is a great module for IoT solutions. For a few dollars you get a powerful microcontroller with built-in support for wifi.

I recommend to...
 

Attachments

  • B4J_ConnectToESP8266.zip
    3.7 KB · Views: 2,546
Last edited:

ESP32 Camera Picture Capture and Video Streaming! (Updated with code!)

Hello!

Last December I made a request for support for the ESP32 Camera support. Well, I finally found the time to work on it myself and here's my initial attempt at implementing this with...
 
Last edited:

ESP8266 - WiFi Remote Configuration

Attachments

  • ESP8266WiFiRemote.zip
    2.6 KB · Views: 5,120
Last edited:

[B4X] B4RSerializator - Send and receive objects instead of bytes

B4R v1.50 includes a new type named B4RSerializator (in rRandomAccessFile library).
B4RSerializator solves a difficult and common task. Sending messages with multiple fields to other platforms...
 

Attachments

  • B4RSerializator.bas
    4.9 KB · Views: 3,129
  • B4R_Server.zip
    1.1 KB · Views: 3,113
  • B4A_Client.zip
    10 KB · Views: 3,166
Last edited:

HC 05 Classic Bluetooth

SS-2016-05-08_17.39.25.jpg


SS-2016-05-08_17.39.57.png


In this example we will connect an Android...
 

Attachments

  • Adruino_Bluetooth_B4A.zip
    9.7 KB · Views: 2,643
Last edited:

B4R Change Log (version history)

Last edited:

How to connect an Arduino Pro Mini to a PC via a USB to Serial module

So you are interested in using an Arduino Pro Mini or compatible board instead of one of the other larger boards to interact with your hardware devices. The Pro Mini does have some advantages over...
 
Last edited:

[tool] External Serial Connector

SS-2016-04-12_15.23.57.png


This is a small B4J program that uses jSerial library to connect to an Arduino board.

To see it working start with this...
 

Attachments

  • B4R_Serial_Connector.zip
    7.2 KB · Views: 1,329
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:

Button Example

SS-2016-04-11_11.44.41.png


B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Private btn As Pin
   Private led As Pin
End Sub

Private Sub...
 

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:

GSM / GPRS - Control the Arduino with SMS messages

SS-2016-05-11_13.27.00.jpg


The GSM shield allows the Arduino to connect to cellular networks. This opens the door for many interesting outdoor...
 

Attachments

  • GSM_Example.zip
    2.3 KB · Views: 1,470
Last edited:

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...
 

MQTT controlling 8 relays, WeMos D1 mini WiFi, Android 4G

Here is a short tutorial on how to control an 8 channel relay module via MQTT. Below you will find both the WeMos and Android source codes needed to get started. The relay module is connected to a...
 
Last edited:

ESP Configurator based on B4RSerializator

SS-2017-07-09_16.48.51.png


This tool replaces the browser based solution...
 

Attachments

  • B4R_ESPConfigurator.zip
    2 KB · Views: 2,563
  • B4J_ESPConfigurator.zip
    46.1 KB · Views: 2,299
Last edited:

RTC DS1302 Example

Hi,

this is an example of using the Real Time Clock DS1302 (from sunfounder).
There are two versions:
1. Manual: Set the time manual befor uploading. After uploading the time is...
 

Attachments

  • B4RHowToRTCDS1302.zip
    347.2 KB · Views: 1,143
Last edited:

DHT11 & DHT22 temperature and humidity sensors ARDUINO UNO Code

This B4R example/library works with DHT11 and DHT22 temperature and humidity sensors:

This inexpensive device (DHT11) allows for measure temperature and humidity:
  • Very Low cost
  • 3...
 

Attachments

  • upload_2016-4-22_12-12-25.png
    upload_2016-4-22_12-12-25.png
    11.7 KB · Views: 1,305
  • DHTlib.zip
    10.1 KB · Views: 1,299
  • rDHTv2.zip
    1.2 KB · Views: 1,108
Last edited:

Inline C / C++

As in the other B4X tools you can embed C or C++ code in the project.

Example:
B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Private Result, N1, N2 As Int 'ignore
End Sub

Private Sub...
 

Connecting to Arduino with BLE (Bluetooth Low Energy)

Attachments

  • B4i_BLE.zip
    3.1 KB · Views: 1,190
  • B4A_BLE.zip
    8.5 KB · Views: 2,013
Last edited:

Connecting two Arduinos with rSoftwareSerial library

SS-2016-04-13_15.50.49.png


With the rSoftwareSerial library you can turn regular pins to serial ports. This is useful as the hardware serial is used...
 

Attachments

  • rSoftwareSerial.zip
    1.7 KB · Views: 1,425
Top