B4RSnippetBase64
Base64 decoding
Base64 decoding
@Erel · 2019-09-08
B4RSnippetDate/time
See human readable Arduino running time
See human readable Arduino running time
@hatzisn · 2019-07-17
B4RSnippetRadiobutton
RadioButton with ESP Server
RadioButton with ESP Server
@Hans- Joachim Krahe · 2019-07-17
B4RSnippetJSON
JSON Parsing
Two methods to help parse JSON strings
@Erel · 2019-07-07
B4RSnippetAudio/Video
Passive Buzzer playing Ludwig van Beethoven''s Fur Elise
Passive Buzzer playing Ludwig van Beethoven''s Fur Elise
@Johan Schoeman · 2019-06-29
B4RSnippetB4R other hardware [F]
SN74HC595N - my effort with this shi[f]t register
The SN74HC595N seem to be a very temperamental shi(f)t register. Took me hours to try and figure it out. Seems to have a lot to do with the timing when driving LED''s (sinking too much current if they are on for too long?). Well, this is my effort - the LED''s flicker on/off, one at a time, from LSB to MSB and then again from MSB to LSB.
@Johan Schoeman · 2019-05-26
B4RSnippetComms & Network
reading smart meter smr5.0 p1 port
reading smart meter smr5.0 p1 port
@MbedAndroid · 2019-04-21
B4RSnippetB4R other hardware
Read a Nunchuk using I2C with B4R an ESP8266
Nothing spectacular the code just reads and logs the joystick x & y axis, the 2 buttons (Z&C), the 3 axis accelerometer data, as well as the calibration data. It works on the OEMs and Knock Offs if you lower the clock speed as indicated. I just ported some Arduino Code to B4R from the website listed in the code.
@KiloBravo · 2019-04-13
B4RSnippetBase64
Base64 encode via Inline C
Base64 encode via Inline C
@KMatle · 2019-04-13
B4RSnippetComms & Network
ESP32 hardware serials on TTGO Lora board
ESP32 hardware serials on TTGO Lora board
@janderkan · 2019-03-09
B4RSnippetB4R clock
DS3231 Clock - Another Snippet
This is a simple read and write with only 4 subroutines and no library. If of interest the ZS-042 module contains a DS3231 and on board I2C EEprom so you can get time and storage on one unit. See External EEPROM in the questions section for the latter ( though I must admit I haven''t tried it on this module)
@rodmcm · 2018-12-06
B4RSnippetB4R other hardware
mcp2317 pullup register set
mcp2317 pullup register set
@Hans- Joachim Krahe · 2018-11-19
B4RSnippetGame
Reading KY-023 dual-axis XY joystick
SubName: Reading an KY-023 joystick Description: You can use this simple code to read the position of a KY-023 dual-axis joystick.
@Peter Simpson · 2018-09-19
B4RSnippetB4R sensor
Reading data from the TMP36 temperature sensor
SubName: Reading a TMP36 temperature sensor Description: You can use this simple code to read the temperature readings from a TMP36 temperate sensor. A few weeks ago I was speaking to B4X user Sorex when he mentioned to me a temperature sensor called a TMP36, I had never heard of this particular temperature sensor before so I decided to buy 5 of them. Note: Yes there is already code on the forum for this sensor, but I thought that I would share this code as it is a direct conversion from demo Arduino IDE code. This sensor is relatively stable but at times it can drift up and down a little bit. I would personally use the DS18B20 temperature module if you are looking for a seriously stable temperature reading, to me the DS18B20 is a more stable temperature sensor with less temperature drift. If you are looking for a general purpose temperate sensor at a bargain price then you can''t really go wrong with the TMP36, look at the spoiler below to view the readings that I was reading.
@Peter Simpson · 2018-08-20
B4RSnippetB4R sensor
Reading a water sensor (3 pin red)
SubName: Reading a water sensor (3 pin red) Description: You can use this simple code to read a 3 pin rain/droplet/water sensor detector. When the sensor is completely dry (no resistance) the logs will show 0(zero). With this particular sensor the more water there is on it, the more there is resistance, thus the reading goes higher.
@Peter Simpson · 2018-08-20
B4RSnippetB4R sensor
Reading a FC-37 water sensor (2 pin black)
SubName: Reading a water sensor (2 pin black) Description: You can use this simple code to read a 2 pin rain/droplet/water sensor detector. When the sensor is completely dry (no water resistance) the logs will show the value 1023. With this particular sensor the more water there is on it the lower the value will go. I personally found that the value 750 is a good water warning trigger (that is basically 1 drop of water).
@Peter Simpson · 2018-08-20
B4RSnippetMap
Map module
It may be nice to have a map in B4R, so here is one, quite primitive. The module is a code module so it enables use of one map. If you need more - copy the module and change its name. The arrays defined in the module have a fixed size which must be set prior to compilation by literals.
@derez · 2018-06-28
B4RSnippetB4R
List module
It may be nice to have a List in B4R, so here is one, quite primitive. The module is a code module so it enables use of one list. If you need more - copy the module and change its name. The array defined in the module has a fixed size which must be set prior to compilation by literals. Sorting will be done only for values of numbers or numerical strings.
@derez · 2018-06-28
B4RSnippetB4R sensor
Measure Analog Sensor on Digital Pin
Explanation is in the code. "Resistive Sensors" examples include Photocells (light sensor), Flex sensors, Thermistors (temperature reading).
@AHilton · 2018-04-18
B4RSnippetB4R other hardware
BluePill on B4R
I have a bunch of bluepills and this weekend started to look into using them with B4R. I don''t tend to use these units with arduino projects as I prefer them with MBED. I have discovered a couple of things. 1: Don''t waste your time on a boot block. It barely works. You have to do some electrical mods that are questionable. And the gain is not much. Use SWLINK instead. A module costs under $5 on ebay and is completely integrated into the Arduino IDE and thus works in B4R. No pins to move. 2: Pin mapping doesn''t happen with B4R. I don''t know why as it is a thing in Arduino. Here is a sub that translates.
@mrred128 · 2018-03-11
B4RSnippetB4R
Various table operation and lookup in PROGMEM
Various table operation and lookup in PROGMEM
@tigrot · 2018-01-22
B4RSnippetB4R LCD/TFT
Define LCD custom characters for HD44780 controllers and compatible.
Here is a code snippet to define custom chars in HD44780 controllers
@tigrot · 2017-11-30
B4RSnippetB4R clock
A small sketch to read and write DS1307 RTC
This is a small sample to read and write date and time to DS1307. The single fields for time and date are defined in the B4R part. For this you need to download new libraries called Time and DS1307rtc in Arduino environment. The ones downloaded with Arduino are old. I have put integer constants to initialize the time and date fields. You can chose to get a string via serial interface and extract the values to init the device.
@tigrot · 2017-10-25
B4RSnippetBluetooth
STM32 - Bluetooth
Following the tutorial here https://www.b4x.com/android/forum/threads/hc-05-classic-bluetooth.66677/ for connecting bluetooth to android I managed to connect android to stm32 with bluetooth (HC-06 in this case). The connection pins are as explained here https://www.b4x.com/android/forum/threads/stm32-and-softwareserial.84936/#post-538283 . The HC-06 requires 5v as vcc but the rx -tx pins use 3.3v so they connect directly to the stm32 rx-tx pins. The led pin number has to change, I used 32 for the on-board green led.
@derez · 2017-10-14
B4RSnippetB4R clock
STM32 - With int/ext RTC and LCD
The attached two applications display real time on LCD 1602 (or similar - just find the address).
@derez · 2017-10-12
B4RSnippetB4R WeMos
MAX30100 interfacing with WEMOS using inline C...
Code to interface MAX30100 (Heart Rate and SPO2 sensor) breakout with WEMOS D1 mini using inline C.
@rbghongade · 2017-10-03
B4RSnippetB4R LED
ByteToRGB algorithm
Most of the data that I am processing for use with WS2812B LEDs is 8 bits and the WS2812B libraries (rNSRainbow and rAdafruitNeoPixels) require RGB format. So I needed a way to convert bytes into RGB. I remembered having done so in an earlier Arduino project and was able to translated the algorithm into Basic. The following Basic code can produce a full range of 256 colors.
@Robert Gately · 2017-08-30
B4RSnippetB4R motor
Adafruit Motor Shield V1 for Arduino...
Code , using inline C, for controlling DC motors via Adafruit Motor Shield V1
@rbghongade · 2017-08-30
B4RSnippetB4R motor
PCA9685 16-channel, 12-bit PWM SERVO board....
Yesterday I received the breakout board for PCA9685 (I2C,16-channel,12-bit PWM) for servo. Here is the B4R code using inline c .Please install the attached Arduino library.
@rbghongade · 2017-08-22
B4RSnippetB4R LED
ESP32 with built in OLED display progress bar - Inline C
SubName: An ESP32 with a built in OLED display screen updating a progress bar. Description: With this example source code, you can place a progress bar on the screen of an ESP32 microcontroller with a built in OLED display. You can display and update the progress bar using Inline C extremely easily. It''s a pretty simple looking progress bar but it does look good if you need one in your project.
@Peter Simpson · 2017-08-20