B4RSnippetB4R LED
ESP32 with built in OLED display connected to WiFi - Inline C
SubName: An ESP32 with a built in OLED display screen connected to WiFi. Description: With this example source code you can connect your ESP32 microcontroller with a built in OLED display to your local WiFi network (Access Point) and display whatever you want on the screen.
@Peter Simpson · 2017-08-20
B4RSnippetB4R other hardware
Tweak the MB-102 power converter
This is actually a Hardware snippet... In many cases you want to use voltage higher than what the MC needs (5v or 3.3v), for example - when you attach motors, or if you need power directly from the source and not limited by the mb-102 current limitation, like I needed to run Raspberry pi by batteries. I soldered one wire to the connections of the plug socket and from now on I need just to connect this pin to the required user. The ground is common to the ground pins of the mb-102.
@derez · 2017-08-04
B4RSnippetB4R other hardware
Reading/Input and Writing/Output using an PCF8575 16 bit I/O extension shield module
SubName: Manipulating all 16 bits/pins from a PCF8575 16 bit I/O IC using only 2 pins from an Arduino.Description: If you are running out of I/O pins on your Arduino based device then I highly recommend that you take a serious look into using a PCF8575 16 bit I/O extension shield module. With the following code you can easily read from or write to all 16 bits/pins of the PCF8575. Writing to the PCF8575 is a simple task of just writing an array of bytes using WireMaster.WriteTo, for example.
@Peter Simpson · 2017-07-30
B4RSnippetB4R EEPROM
ESP8266 Check flash configuration - Memory comparison
SubName: ESP8266 Check flash configuration Description: This code tests if the selected EEPROM settings in the IDE matches the actual device that is being used.
@Peter Simpson · 2017-06-29
B4RSnippetB4R sensor
ESP32 touch capable sensing pins
SubName: ESP32 touch pins Description: The ESP32 comes with 10 touch capable sensing pins called T0 to T9, these pins are capacitive and extremely easy to read, so easy in fact that I''m not even going to attach a photo to this post. To manipulate a touch pin, you just have to connect a breadboard jumper wire to one of the touch capable pins, in this example I''m using T0 (Touch0) which is on D4 (GPOI4). Once you have connected the wire to the D4 touch pin, you just have to touch the end of the wire with your finger and then read the results. When you touch the pin with your finger the reading will drop. In the example below the reading drops from 89 to 8.
@Peter Simpson · 2017-06-26
B4RSnippetB4R LED
Shift Register 74HC595 - Controlling 8+ LED''s with only 3 pins
SubName: Controlling 8 LED''s with only 3 pins from your Arduino through a shift register. Description: Here is some basic code for controlling 8 LED''s through a 74HC595 shift register, you could in fact control a lot more LED''s using multiple shift registers and still only using 3 pins from your Arduino device. You can use shift registers to control anything from LED''s to multiple 8 channel relay modules etc.
@Peter Simpson · 2017-06-17
B4RSnippetB4R Wemos
Interfacing PCF8574 8 bit IO port expander module...
The code snippet interfaces Arduino Uno/ Wemos mini with PCF8574 , 8 bit IO port expander via I2C bus
@rbghongade · 2017-06-06
B4RSnippetImages
GFX and Bitmaps
This code uses inline C to store 1-bit bitmaps in the program code (PROGMEM) and draws them with the rAdafruitGFX library. You can use this tool to generate the bitmaps data: https://github.com/ehubin/Adafruit-GFX-Library/blob/master/Img2Code/Image2Code.jar
@Erel · 2017-05-25
B4RSnippetB4R relay
5V 8-Channel relay module for Arduino
Here is some basic code for switching an 8 channel relay from ''NO'' (Normally Open) to ''NC'' (Normally Closed). The code is initialising each pin (eight pins in total) in a loop and then runs Loopey. In Loopey each relay is being switched from ''NO'' to ''NC'', this is done one relay at a time with a 100 milliseconds delay until all the relays are closed, then the routine is ran again but in reverse switching the state of each relay one at a time until all the relays are ''NO'' again.
@Peter Simpson · 2017-05-14
B4RSnippetB4R other hardware
Mini Battery Display - Inline C
Here is a quick example of inline C being used to power a mini battery display. As there''s no library for this display on the forum, I used inline C with the original Arduino IDE source code. I''ve slimmed down the inline C code to make it easier to read. You can find the original library and source code on Github, just copy the 2 library files into your Arduino IDE library folder.
@Peter Simpson · 2017-05-11
B4RSnippetB4R motor
Set servo angle via potentiometer and show on display
SubName: Set a servo angle and show the angle reading on a OLED display Description: Their are already a few servo examples on this forum, but here is my take on it. I''m using a quality TURNIGY servo and a standard cheap 10kΩ potentiometer. As you turn the potentiometer the display changes to shows you the angle that the servo is set to, reading ranges from 0° to 179°.
@Peter Simpson · 2017-04-19
B4RSnippetB4R sensor
Reading and display voltage and current made easy
SubName: Reading voltage and current and display the results onto an OLED display. Description: Use the code below to display the voltage and current from load connected to a MAX471 module. The Max471 is a low cost precision high side current sense amplifiers with a maximum supply voltage of 36V. I personally would not push it that high, but putting 25V through it for a 5V Arduino or compatible device is more than adequate.
@Peter Simpson · 2017-04-16
B4RSnippetB4R sensor
Temperature sensors comparison - DS18B20 vs DHT11
Comparing the DS18B20 and the DHT11 temperature sensors at the exact same time This is just a quick comparison between the two above named temperature sensors, nothing special really. I was looking through my Arduino parts toolbox when I suddenly realised that I had two types of temperature sensors, I had not even opened the anti-static bag with the DHT11 inside it, so I decided to place them both on a mini breadboard with a 4 pin OLED display to compare and display their temperature readings.
@Peter Simpson · 2017-04-01
B4RSnippetB4R sensor
Reading temperature sensor DS18B20 via inline C/C++, again
You can use this basic code to read the temperature readings from a DS18B20 temperature module, this can easily be done using inline C/C++. I''m reading °C but you can easily change it to °C by replacing ''sensors.getTempCByIndex(0)'' with ''sensors.getTempFByIndex(0)''.
@Peter Simpson · 2017-04-01
B4RSnippetButton
Long press short press one button
This is just one solution on how to tell if a button is being long pressed or short pressed. There are plenty of other solution to do this, this is my take on it, it''s simple but effective.
@Peter Simpson · 2017-03-30
B4RSnippetDrawing
Example of GFX.drawLine (Adafruit GFX library)
Use this code to draw and rotate lines onto an OLED display. You will need the rAdafruitSSD1306 and rAdafruitGFX libraries loaded into your libraries tab. The code is simple enough to follow once you get your head around it, this is good for learning GFX.drawLine.
@Peter Simpson · 2017-03-10
B4RSnippetB4R WeMos
HMC5883L interfacing with Wemos...
Interface HMC5883L (Triple-axis Magnetometer (Compass)) with Wemos (ESP8266) with inline C
@rbghongade · 2017-03-07
B4RSnippetComms & Network
Set IP address static/fixed for ESP8266
Set IP address static/fixed for ESP8266
@ilpesce · 2017-03-06
B4RSnippetMaths
Modulo Operator (Inline C)
Modulo Operator (Inline C)
@inakigarm · 2017-03-06
B4RSnippetB4R sensor
measuring low frequenzy with ADXL335
measuring low frequenzy with ADXL335
@Hans- Joachim Krahe · 2017-03-04
B4RSnippetB4R clock
Display the current time via DS1302 RTC
Displaying the current time on a 4 Bit 7 segment display from a battery backed up DS1302 RTC (Real Time Clock).
@Peter Simpson · 2017-03-03
B4RSnippetB4R EEPROM
EEPROM Clear
This example illustrates how to set of all of the bytes to zero (0), initialising them to hold new information, using the EEPROM.WriteBytes function.
@Peter Simpson · 2017-03-01
B4RSnippetSerial comm/USB
Arduino Serial Command Framework
This framework simplifies serial interfacing via a command / response infrastructure. My Arduino projects are usually purely gadget interfaces linked to a higher functioning PC/ORDROID/Android device to actually do the orchestration. There is a built in method to identify the board via an ID and physically by blinking an on board led (pin 13).
@mrred128 · 2017-02-25
B4RSnippetB4R sensor
Switch a relay (to On) when it gets dark via an LDR and PIR
Switch a relay (to On) when it gets dark via an LDR and PIR
@Peter Simpson · 2017-02-23
B4RSnippetB4R sensor
Reading two sensors by A0 pin
Reading two sensors by A0 pin
@derez · 2017-02-20
B4RSnippetB4R LED
Control LED brightness via 1838 IR receiver
You can use this basic code to control an LED (or anything else for that matter) that you want with a standard IR receiver. I was using a single off board VS1838B/TL1838 38KHz IR receiver with a Samsung TV remote control. Using the PWM (Pulse Width Modulation) pins is essential for controlling the brightness.
@Peter Simpson · 2017-02-18
B4RSnippetJSON
Data JSON Format to Node-RED
For sending data from Arduino/ESP to Node-RED (running on a Raspberry Pi), JSON format is an option as Node-RED provides simple methods for parsing JSON. The example sub writes via asyncstream a Key:Value Pair Array as a JSON string.
@rwblinn · 2017-02-14
B4RSnippetB4R WeMos
TCS34725 RGB Sensor interface with Wemos mini...
TCS34725 RGB Sensor interface with Wemos mini...
@rbghongade · 2017-02-13
B4RSnippetB4R WeMos
BME280 with ESP8266 (Wemos mini)...
Interface the Bosch BME 280 sensor with ESP8266 via inline C code and the Arduino library
@rbghongade · 2017-01-30
B4RSnippetB4R motor
driving xy stepmotors by single byte
driving two motors (x,y) with 16 steps can be realized by one byte orders (16 stepmodes in upper 4 bit, 16 in lower 4 bit)
@Hans- Joachim Krahe · 2017-01-08