B4R Tutorials

MQTT

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:

ESP8266 + UDP + BMP180 = Simple weather station

This is an example of how UDP can be used to broadcast the current temperature and pressure to one or more clients.

The nice thing about it is that there is no server involved. The ESP8266 just...
 

Attachments

  • B4A_Weather.zip
    7.8 KB · Views: 1,950
  • B4J_Weather.zip
    981 bytes · Views: 1,310
  • B4R_Weather.zip
    1.1 KB · Views: 2,000
  • B4i_Weather.zip
    2.3 KB · Views: 1,055

How to Implement STM32 into B4R

If you want more FLASH memory space (say 128K flash), need more RAM (how about 20K), would like your program to run a little faster, or simply want to play around with a different micro-controller...
 

Attachments

  • How to Implement STM32 to B4R.pdf
    207.7 KB · Views: 491
Last edited:

Using Firebase to send notifications to iOS and Android devices

Attachments

  • ESP8266_Push.zip
    1.5 KB · Views: 2,329

Creating libraries for B4R

Libraries are written in C++.
Libraries are made of a single h file and one or more cpp files. Libraries can also include other h files which will not be exposed.

All the files should be in the...
 

Attachments

  • B4Rh2xml.jar
    98 KB · Views: 1,381
Last edited:

Arduino to WeMos pin mapping

Hello,
Not exactly a tutorial, but informative nevertheless.

This is how to map your Arduino projects to your WeMos. So for example in the blink demo, you just choose pin 2 for a WeMos instead of...
 
Last edited:

BLE (HM-10 module) - Broadcasting a single byte

SS-2016-04-13_17.54.33.jpg


In this example I'm using a BLE shield to broadcast the state of a connected button.

The byte is sent as part of...
 

Attachments

  • B4A_BLE_ButtonState.zip
    7.9 KB · Views: 1,254
  • B4i_BLE_ButtonState.zip
    2.9 KB · Views: 752

UDP Communication

rEthernet library v1.10 (included in v1.00 beta 9) includes a new type named EthernetUDP. It allows sending and receiving UDP packets.

UDP is simple to work with as it is a connection-less...
 

Attachments

  • B4A_UDP.zip
    8.1 KB · Views: 1,429

ESP8266 + Relay = Let there be light

Relays are electronic switches that allow low power (voltage) devices to control high power circuits.

In this example the ESP8266 board controls a regular 220v light bulb.

*** High power...
 

Attachments

  • B4A_Relay.zip
    7.8 KB · Views: 1,340
Last edited:

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

Arduino + Raspberry Pi

SS-2016-04-14_14.54.06.jpg


In this tutorial we will create a currency converter solution that shows the conversion from USD to other currencies on...
 

Attachments

  • B4J_CurrencyConverter.zip
    1.5 KB · Views: 896
Last edited:

ESP8266 FTP Client

Attachments

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

Setting and Reading date and time of a DS1302 (RTC) without a library

I have one of the "MH-REAL-TIME CLOCK MODULES - 2" with a DS1302 chip. I thought it would be interesting to see if I could read the seconds, minutes, hours, year, month, day of month, and day of...
 

Attachments

  • b4rReadDS1302manually.zip
    2.2 KB · Views: 517
  • DS1302 Real Time Clock.pdf
    354.3 KB · Views: 578

Writing and reading from the EEPROM

The EEPROM is in most cases the only persistent storage available. As a persistent storage we can use it to store data that will not be lost when the board is turned off.

The rEEPROM library...
 

Ethernet / Network Tutorial

This example uses an Ethernet shield to connect to a server. In this case the server is implemented with B4J, though you can easily implement a similar server with B4A or B4i.

Whenever the user...
 

Attachments

  • EthernetExample.zip
    1.2 KB · Views: 1,188
Last edited:

B4R Experiments

Hi,

whilst exploring B4R (as a hobbyist), build experiments in several categories. The experiments also show B4X integration examples.
A few experiments to mention:

Change Log...
 
Last edited:

Servo motor and Arduino

Thanks to @Erel and the new rservo library (Beta#7), we've access to servo motors.

Servos are a motor type that allows for precise control of angular or linear position, velocity and...
 
Last edited:

Additional Hardware Serial Ports

Some boards like Arduino Mega and Arduino Due have several hardware serial ports. These ports are very useful if you need to interact with multiple modules. The alternative for multiple hardware...
 
Last edited:

Programming an ESP8266 (ESP-12x) via a USB to Serial adaptor

Programming an ESP-12x module directly is not too difficult. If you purchase an ESP8266 with a built-in USB port like a WeMos D1 Mini or a NodeMCU etc, then you do not need to do this as the...
 
Last edited:
Top