B4R Tutorials

Data types

The following data types are available in B4R:

Numeric types:

Byte: 0 - 255
Int (2 bytes): -32768 - 32768. Similar to Short type in other B4X tools.
UInt (2 bytes): 0 - 65535.
Long (4 bytes)...
 

Play The Piano - Create Arduino and B4R code.

With this tool you can create Arduino and B4R code to be played in a passive Buzzer. You just play the song in the piano and the code is created automatically. When you play the last note leave it...
 

Attachments

  • PianoCode.zip
    2 KB · Views: 153
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: 2,084

Home Control 4

Hi guys
I want to share my project on this great community (source code free no donation)
I think it may be useful to someone
in the source code I commented out the functions
it should be simple...
 

Attachments

  • B4R-Home-Control.zip
    2 KB · Views: 1,127
  • B4J-HomeControl.zip
    4.4 KB · Views: 1,144
  • B4A-HomeControl.zip
    13.4 KB · Views: 1,062

How to calculate device's battery lifetime ?


Say, device with tiniest MCU (needed just 2 mA current for work) powered by CR2032 battery (of 200 mAh capacity) and sleeping almost 5 mins...
 

Attachments

  • TempDownload.png
    TempDownload.png
    96.7 KB · Views: 786
Last edited:

esp32 MCU family SDK in Arduino v2.3.7

The new esp32 SDK is got of very huge size and the downloading (and + unpacking + installation) is failed due to the timeout is out.
Add\edit the "connection_timeout" parameter in the settings...
 

Attachments

  • 1766565575934.png
    1766565575934.png
    138.2 KB · Views: 374
Last edited:

All ESP32 modules in 2025

 

ATMEGA2560 ALL FOUR UART WORKING Example

ATMEGA2560:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 2000
#End Region
'Ctrl+Click to open the C code folder...
 
Last edited:

Controllino Mini

Received it today (24vdc input) and using it to control banks of short and medium wave infrared lights to dry print on flexo graphic printing machines using water based inks (previously solvent...
 

Embedded development base lessons from DeepSeek

Lessons i have prepared for beginners in Arduino and B4R.




Fundamentals of Microcontroller Device Research for Beginner Arduino Developers​

Introduction​

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

P-MOSFETs

Today I was impressed. While being at the university, some 20 years ago I 've had a hard time understanding the principles of Transistors and MOSFETs. That was partly because I was starting...
 
Last edited:

Arduino-PIDController-Library

An inline C wrap for this Github project. Should be able to use it for PID control. It works very well.

Study the code - change your pins to what you need. For the attached project:
A0 =...
 

Attachments

  • B4RControllinoPIDtoModify.zip
    5.4 KB · Views: 795

Controllino Mega PLC Examples

Attached is a B4R project (using inline C) to manipulate the ports of the Controllino Mega. In this project we do the following:
1. Toggle the OVL (over voltage) LED of the PLC between on/off...
 

Attachments

  • ControllinoPorts.zip
    1.2 KB · Views: 760

I3C

Today I learned a new thing. Besides I2C there is also I3C which has different key features than I2C but can operate at a legacy mode also. I am under the impression that it is a fairly new thing...
 

Provisioning: Start Access point, display it's Wifi credentials as a Wifi-QRCode (can be scanned by any phone)

As the title says, a standard WiFi-QRCode ist displayed on a tft screen. This can be scanned by any modern phone to automatically and it connects to the ESP, so you don't need to type any...
 

Attachments

  • QRConnect.zip
    3.6 KB · Views: 776

TFT displays: TFT_ESPI (inline C) example

Update:

1. Init Display as a separate sub
2. TFT_ESPI as "global"
3. Drawtext as a sub with parms
4. Updated example


Although there is a library and I appreciate the good work, I like to...
 

Attachments

  • TFT_B4R.zip
    1.4 KB · Views: 893
Last edited:

For those who like handmade signs

For those who enjoy making their own 8 Relays, DS18b20, Buzzer, Display, LDR Sensor,
 

Attachments

  • Imagem do WhatsApp de 2024-01-20 à(s) 13.40.35_1218f8de.jpg
    Imagem do WhatsApp de 2024-01-20 à(s) 13.40.35_1218f8de.jpg
    156.9 KB · Views: 871
  • 20240109_175211.jpg
    20240109_175211.jpg
    232.7 KB · Views: 880
  • Casa_Control PCB.zip
    87.4 KB · Views: 722

my second project with you

Hey guys, how are you?
I want to share my second project with you
Fan control with timer
I just got the same control back via Alexa and it couldn't work so that you have the best interest. I'm...
 

Attachments

  • 20240119_160906.jpg
    20240119_160906.jpg
    93.4 KB · Views: 877
  • PCB.JPG
    PCB.JPG
    294.4 KB · Views: 880
  • CONTROLE DE VENTILADOR_PCB.zip
    35 KB · Views: 722
  • Backup ESP_Config 2023-09-04 08.55.zip
    7.6 KB · Views: 744
  • Backup Casa_Controle_8 2023-07-04 16.26.zip
    70.6 KB · Views: 775

Writing & Reading Serial EEPROM 24C512 With Arduino Uno Using rWire

SERIAL EEPROM 24C512 Reading & Writing:
Sub Process_Globals
    Public Serial1 As Serial
    Private Wire As WireMaster
    Dim bc As ByteConverter
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")...
 
Top