I noticed Boardotron buyers trying to find support so I gathered some information... here.
Software zip file (link)
Software zip file download here (sketches and libraries): boardotron.zip (13.7 KB)
List of sketches:
- 01_Digital_Output
- 02_Digital_Input
- 03_Analog_Output_RGB
- 04_Analog_Input
- 05_Thermistor
- 06_Temp-Hum_DHT11
- 07_OLED_Display
- 08_Melody
- 09_IR_Receiver
- Full_Demo
IMAGES showing pins used:
Below is full_demo.ino in wokwi.com... This demo is using an old IRremote.h. You will get warnings when compiling. Follow the instructions in the warnings. Compiles to 83% of memory capacity.
// NOTES FROM XFPD: slowly getting to these issues
// - RGBLED is not lighting (maybe I picked the wrong "COM" CC or CA)
// - Buzzer not sounding - probably a timing issue
// - buttons work, but unresponsive - definitely a timing issue
// - "therm" what? - probably a wokwi device being use (by me) improperly
// - IR recording - it starts and reports, but does not record
// - OLED - it works!
full_demo.ino for wokwi
// Amazon
// https://www.amazon.com/Boardotron-UNO-Learning-Shield-Multifunctional/dp/B0D2QK9PZD
// https://m.media-amazon.com/images/I/81tVJEvlGoL._AC_SL1500_.jpg (board)
// https://m.media-amazon.com/images/I/61jSoa+kZRL._AC_SL1050_.jpg (pins)
// Software download
// https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqa3JUZExpSVRudTE5S3c2aWNyeUhmVmFVUzExUXxBQ3Jtc0tuQ01wM0Y4Ty1aM3dpX1JZSzMtNklyVC1oOW45ZEVhTTdjUUZFNTZWb0hrTzhKcE44aDlGR3VHcnRzVi1USmVsdnlhLWJUYzIxQ2IyLTdiNXBlN3FzZXpMd1VnTEdXUnp6YXc2TkM4X1F0Z0Vtb1VVOA&q=https%3A%2F%2Fd76ec187-54dd-4dae-a9a6-5b9ecf325603.filesusr.com%2Farchives%2F5e1a43_f96c9a4bc4a242f7819bad518ac7e57d.zip%3Fdn%3DExamples.zip&v=X7ElkONq6W0
// YouTube channel
// https://www.youtube.com/@Boardotron
// Tutorial video
// https://www.youtube.com/watch?v=X7ElkONq6W0
/*
Demo for the Boardotron UNO Learning Shield with an Arduino UNO R3
Features:
- Red LED turns ON while holding the button 1.
- Toggle blue LED every time the button 1 is press.
- Button 2 turns ON RGB LED and creates a tone sound through the piezo speaker.
- Button 1 turns OFF RGB LED.
- Color of the RGB LED can be changed using the potentiometer.
- Show in the OLED display: temperature and humidity from the DHT11 sensor, the analog value from
the potentiometer, the analog value from the light sensor, temperature from the thermistor, and
color values from the RGB LED (0-255 of red, green and blue).
- While holding button 1, if arduino receives a signal from the IR receiver coming from a remote
control, the signal is going to be stored allowing to react to that button the same way as the
button 1.
Limitation:
- When we press the button 2, that enables the RGB LED, the IR receiver is going to stop responding.
The only way to enable the IR receiver again is to reset the Arduino board. This is because of the
conflict created by timers inside Arduino, used by the different libraries. That's also the reason
why the tone pitch changes depending on the value of the PWM of the RGB.
You need to install these libraries:
- DHTlib by RobTillaart https://github.com/RobTillaart/DHTlib
- IRremote by shirriff, z3t0, ArminJo https://www.arduinolibraries.info/libraries/i-rremote
- Adafruit SSD1306 by Adafruit https://github.com/adafruit/Adafruit_SSD1306
- Adafruit GFX Library by Adafruit https://github.com/adafruit/Adafruit-GFX-Library
*/
///////////////////////////
////// Adjustments ////////
///////////////////////////
const int IRReceiverTimeout = 3; // Amount of timeout when pressing button on remote control.
// The higher the value the longer it will take to notice that we released the button, but
// if the value is too low then arduino is going to think we are pressing the button multiple
// times even if we only pressed once.
///////////////////////////
////////// Pins ///////////
///////////////////////////
const int Button1Pin = 2; // Pin for button 1
const int Button2Pin = 3; // Pin for button 2
const int pinDHT11 = 4; // Set the pin connected to DATA in the DHT11 sensor
const int SpeakerPin = 5; // Pin for speaker
const int IRReceiverPin = 6; // Pin for IR receiver
const int Pin7 = 7; // Pin for digital connector
const int Pin8 = 8; // Pin for digital connector
const int RGBLEDRedPin = 9; // Pin for RGB LED red
const int RGBLEDGreenPin = 10; // Pin for RGB LED green
const int RGBLEDBluePin = 11; // Pin for RGB LED blue
const int RedLEDPin = 12; // Pin for LED red
const int BlueLEDPin = 13; // Pin for LED blue
const int PotentiometerPin = A0; // Pin for potentiometer
const int LightSensorPin = A1; // Pin for light sensor
const int ThermistorPin = A2; // Pin for thermistor
const int PinA3 = A3; // Pin for analog connector
///////////////////////////
/////// Variables /////////
///////////////////////////
int RGBPowerState = LOW; // Stores if RGB LED is ON or OFF. HIGH=ON, LOW=OFF
char string1[10]; // Create a character array of 10 characters so later we convert a variable to a string to have right text alignment
char string2[10]; // Create a character array of 10 characters so later we convert a variable to a string to have right text alignment
char string3[10]; // Create a character array of 10 characters so later we convert a variable to a string to have right text alignment
int StateOfButton1; // Variable to store digital read for button 1
int StateOfButton2; // Variable to store digital read for button 2
int PotentiometerValue; // Stores the analog input of the potentiometer
int color; // Create variable that is going to store the color range for the RGB
int redIntensity; // It stores the intensity for red color in the RGB LED
int greenIntensity; // It stores the intensity for green color in the RGB LED
int blueIntensity; // It stores the intensity for blue color in the RGB LED
int ThermistorValue; // Analog read the pin connected to the thermistor
int Temperature2; // Stores the temperature calculated from the thermistor
int LightSensorValue; // Stores the raw analog value of the light sensor
// DHT11 sensor:
int DHT11Temperature; // Variable to store the value of the temperature
int DHT11Humidity; // Variable to store the value of the Humidity
int CounterDHT; // Counter to prevent reading the sensor too often
int LastTempValue; // To ignore error readings
int LastHumValue; // To ignore error readings
int TempErrorCounter; // Counter if current is different than last, to avoid error readings
int HumErrorCounter; // Counter if current is different than last, to avoid error readings
#include <dht.h> // Include library to allow reading the DHT11 sensor
dht DHT; // Create sensor DHT11
int chk; // Variable to store raw data from DHT11 sensor
// IR Receiver:
#include <IRremote.h> // Include the library for the IR receiver
uint64_t decCode; // Create variable to store the code we received from the remote control
int state = LOW; // The current state of the output pin
int previous = LOW; // The previous reading from the input pin
int ButtonRemoteControlState = 0; // Button toggle state for remote control
int ButtonRemoteControlCounter = 0; // Counter for holding button to debounce remote control
byte IRSignalReceived; // Store if we received a IR remote control code.
// HIGH = we are receiving a signal.
// LOW = we are not receiving a signal.
unsigned long RemoteControlCode; // It stores the code of the remote control button
#include <EEPROM.h> // Include the EEPROM library to allow saving data permanently
///////////////////////////
///////// Display /////////
///////////////////////////
#include <Adafruit_SSD1306.h> // Include library to drive the display
#include <Adafruit_GFX.h> // Include core graphics library for the display
Adafruit_SSD1306 display(128, 32); // Create display indicating the resolution ( [Resolution-X] , [Resolution-Y] )
// The most common resolutions are 128,32 and 128,64
void setup() { // Start of setup - Runs once when we reset or power the board
delay(500); // This delay is needed to let the display and DHT11 sensor to have time to initialize
// Set input and outputs:
pinMode(Button1Pin, INPUT_PULLUP); // Set pin as input enabling the internal pull-up resistor
pinMode(Button2Pin, INPUT_PULLUP); // Set pin as input enabling the internal pull-up resistor
pinMode(SpeakerPin, OUTPUT); // Set pin as output
pinMode(RGBLEDRedPin, OUTPUT); // Set pin as output
pinMode(RGBLEDGreenPin, OUTPUT); // Set pin as output
pinMode(RGBLEDBluePin, OUTPUT); // Set pin as output
pinMode(RedLEDPin, OUTPUT); // Set pin as output
pinMode(BlueLEDPin, OUTPUT); // Set pin as output
pinMode(PotentiometerPin, INPUT); // Set pin as input
pinMode(LightSensorPin, INPUT); // Set pin as input
pinMode(ThermistorPin, INPUT); // Set pin as input
// Start serial communication to allow printing data in the serial monitor:
Serial.begin(9600); // Start serial communication with baud rate of 9600 bps
// IR Receiver:
IrReceiver.begin(IRReceiverPin); // Start IR receiver
// Display:
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Initialize display with the I2C address of 0x3C
display.clearDisplay(); // Clear the buffer
display.setTextColor(WHITE); // Set color of the text
display.setRotation(0); // Set orientation. Goes from 0, 1, 2 or 3
display.dim(0); // Set brightness (0 is maximum brightness and 1 is dim)
// DHT11 Temperature and Humidity sensor:
chk = DHT.read11(pinDHT11); // Read the raw data from the sensor
DHT11Temperature = DHT.temperature; // Variable to store the value of the temperature
DHT11Humidity = DHT.humidity; // Variable to store the value of the Humidity
LastTempValue = DHT11Temperature; // Store current temperature as the last value
LastHumValue = DHT11Humidity; // Store current humidity as the last value
} // End of setup
void loop() // Start of loop - Runs over and over again indefinitely
{
// Read buttons:
StateOfButton1 = digitalRead(Button1Pin); // Digital read input pin for button 1
StateOfButton2 = digitalRead(Button2Pin); // Digital read input pin for button 2
// Button 2 action:
if (StateOfButton2 == LOW) // If the button 2 is press
{
RGBPowerState = HIGH; // Set RGB LED as powered ON
tone(SpeakerPin, 3830, 100); // Play a tone ( [Pin] , [Frequency] , [Duration_ms] )
}
// Turn OFF RGB LED if we press button 1:
if (StateOfButton1 == LOW && StateOfButton2 == HIGH) // If the button 1 is press and button 2 is release
{
RGBPowerState = LOW; // Set RGB LED as powered OFF
// Turn OFF RGB LED:
analogWrite(RGBLEDRedPin, 0); // ( [Pin] , [Value_0-255] )
analogWrite(RGBLEDGreenPin, 0); // ( [Pin] , [Value_0-255] )
analogWrite(RGBLEDBluePin, 0); // ( [Pin] , [Value_0-255] )
}
// RGB LED:
// Read the analog value of the potentiometer:
PotentiometerValue = analogRead(PotentiometerPin); // The output is a value between 0-1023
// Set color of RGB LED:
// Lets remap the range of the potentiometer into a color value:
color = map(PotentiometerValue, 0, 1023, 0, 1535); // Remap range of values into another range of values ( [InputVariable] , [MinimumIN] , [MaximumIN] , [MinimumOUT] , [MaximumOUT] )
// Spectrum to use in RGB LED:
// 0 = White
// 255 = Yellow
// 511 = Green
// 767 = Cyan
// 1023 = Blue
// 1279 = Purple
// 1535 = Red
// Here we'll use an "if / else" statement to determine which
// of the three (R,G,B) zones "color" falls into. Each of these zones
// spans 255 because analogWrite() requires a number from 0 to 255.
// In each of these zones, we'll calculate the brightness
// for each of the red, green, and blue LEDs within the RGB LED.
if (color <= 255) // zone 1 - white to yellow
{
redIntensity = 255; // red on
greenIntensity = 255; // green on
blueIntensity = 255 - color; // blue on to off
} else if (color <= 511) // zone 2 - yellow to green
{
redIntensity = 255 - (color - 256); // red on to off
greenIntensity = 255; // green on
blueIntensity = 0; // blue off
} else if (color <= 767) // zone 3 - green to cyan
{
redIntensity = 0; // red off
greenIntensity = 255; // green on
blueIntensity = (color - 512); // blue off to on
} else if (color <= 1023) // zone 4 - cyan to blue
{
redIntensity = 0; // red off
greenIntensity = 255 - (color - 768); // green on to off
blueIntensity = 255; // blue on
} else if (color <= 1279) // zone 5 - blue to purple
{
redIntensity = (color - 1024); // red off to on
greenIntensity = 0; // green off
blueIntensity = 255; // blue on
} else // color > 1279 // zone 6 - purple to red
{
redIntensity = 255; // red on
greenIntensity = 0; // green off
blueIntensity = 255 - (color - 1280); // blue on to off
}
// Now that the brightness values for each color has been set, we can write the LEDs to those values:
if (RGBPowerState == HIGH && StateOfButton1 == HIGH) // If RGB state is ON and button 1 is not press
{
// Analog write RGB LED:
analogWrite(RGBLEDRedPin, redIntensity); // ( [Pin] , [Value_0-255] )
analogWrite(RGBLEDGreenPin, greenIntensity); // ( [Pin] , [Value_0-255] )
analogWrite(RGBLEDBluePin, blueIntensity); // ( [Pin] , [Value_0-255] )
}
// Light sensor:
// Read the analog value in the light sensor:
LightSensorValue = analogRead(LightSensorPin); // The output is a value between 0-1023
// DHT11 Temperature and Humidity sensor:
if (CounterDHT == 20) // If counter is equal to 20
{
// Read DHT11 sensor:
chk = DHT.read11(pinDHT11);
DHT11Temperature = DHT.temperature; // Store the value of the temperature
DHT11Humidity = DHT.humidity; // Store the value of the Humidity
// Ignore error readings:
// The sensor sometimes randomly gives wrong values in the temp and hum.
// We are going to ignore them by comparing the last value to the current value and
// if they are different, we read again. If the readings is still the same, then we
// consider it's a valid value and we can display it.
// Ignore errors on temperature:
if (DHT11Temperature != LastTempValue) // If current temperature is different than the last temperature
{
if (TempErrorCounter == 1) // If counter is equal to 1
{
LastTempValue = DHT11Temperature; // Set last value the same as the current value
TempErrorCounter = 0; // Reset counter to start over
} else {
DHT11Temperature = LastTempValue; // Set outout the same as the value stored in the last reading, to ignore the current value
TempErrorCounter++; // Increase timer by 1 so we can wait longer
}
} // End of if current temperature is different than the last temperature
else {
TempErrorCounter = 0; // Reset counter to start over
}
// Ignore errors on humidity:
if (DHT11Humidity != LastHumValue) // If current humidity is different than the last humidity
{
if (HumErrorCounter == 1) // If counter is equal to 1
{
LastHumValue = DHT11Humidity; // Set last value the same as the current value
HumErrorCounter = 0; // Reset counter to start over
} else {
DHT11Humidity = LastHumValue; // Set outout the same as the value stored in the last reading, to ignore the current value
HumErrorCounter++; // Increase timer by 1 so we can wait longer
}
} // End of if current humidity is different than the last humidity
else {
HumErrorCounter = 0; // Reset counter to start over
}
CounterDHT = 0; // Reset counter so it can start over
} // End of if counter is equal to 20
else {
CounterDHT++; // Increase timer by 1 so we can wait longer
}
// Thermistor:
ThermistorValue = analogRead(ThermistorPin); // Analog read the pin connected to the thermistor
// Lets remap the range of the thermistor into a known temperature range (°C):
Temperature2 = map(ThermistorValue, 269, 741, 2, 47); // Remap range of values into another range of values ( [InputVariable] , [MinimumIN] , [MaximumIN] , [MinimumOUT] , [MaximumOUT] )
// Raw input , RawLow , RawHigh , TempLow , TempHigh
// Read value from the EEPROM:
EEPROM.get(0, RemoteControlCode); // Read address 0 of the EEPROM and store the value in the variable called "RemoteControlCode"
// IR Receiver:
if (IrReceiver.decode()) // If we receive a signal from the IR receiver
{
decCode = IrReceiver.decodedIRData.decodedRawData; // Store the code we received
// Ignore if code is 0 (invalid):
if (decCode != 0) // If code is not 0
{
Serial.println(IrReceiver.decodedIRData.decodedRawData); // Print in the serial monitor the value of the remote control
IRSignalReceived = HIGH; // Store that we received a code from IR receiver from a remote control
}
IrReceiver.resume(); // Receive the next value
if (decCode == RemoteControlCode) // If we receive this code coming from the button in a remote control
{
ButtonRemoteControlCounter = IRReceiverTimeout; // Reset the counter so we can know if we are still holding the button
}
} // End of if we receive a signal from the IR receiver
else // If we are not receiving a signal
{
if (ButtonRemoteControlCounter > 0) // If counter is above 0
{
ButtonRemoteControlCounter--; // Reduce counter
}
IRSignalReceived = LOW; // Store that we are not receiving a signal from IR receiver
} // End of if we are not receiving a signal
// Read remote control button:
if (ButtonRemoteControlCounter > 0) // If button counter is not 0, means it's pressed so do the following
{
ButtonRemoteControlState = HIGH; // Record on state that is depress
} else {
ButtonRemoteControlState = LOW; // Record on state that is release
}
// Learning and storing remote control button:
if (StateOfButton1 == LOW && IRSignalReceived == HIGH) // If we press button 1 and we receive a signal from remote control
{
// Write value into the EEPROM:
EEPROM.put(0, decCode); // Write the address 0 of the EEPROM with the value of the IR signal
}
// Turn LED ON only while button is depress:
if (ButtonRemoteControlState == HIGH || StateOfButton1 == LOW) // If button 1 or remote control button is depress
{
digitalWrite(RedLEDPin, HIGH); // Turn Red LED ON ( [Pin] , [Level_HIGH-LOW] )
}
if (ButtonRemoteControlState == LOW && StateOfButton1 == HIGH) // If button 1 and remote control button is release
{
digitalWrite(RedLEDPin, LOW); // Turn Red LED OFF ( [Pin] , [Level_HIGH-LOW] )
}
// Toggle LED ON/OFF:
if (ButtonRemoteControlState == HIGH || StateOfButton1 == LOW) // If button 1 or remote control button are press
{
if (previous == LOW) // If we haven't executed this part yet
{
if (state == HIGH) // If toggle state is HIGH
{
state = LOW; // Change toggle state to LOW
} else // If toggle state is LOW
{
state = HIGH; // Change toggle state to HIGH
}
previous = HIGH; // Set that we already executed this, so later we don't run it again
} // End of if we haven't executed this part yet
} // End of if button 1 or remote control button are press
digitalWrite(BlueLEDPin, state); // Turn Blue LED ON or OFF depending on the state of the toggle switch ( [Pin] , [Level_HIGH-LOW] )
if (ButtonRemoteControlState == LOW && StateOfButton1 == HIGH) // If button 1 and remote control button is release
{
previous = LOW; // Reset the previous state as release so we can be prepare to execute the toggle code again later when any button is press
}
// Convert Temperature into a string, so we can change the text alignment to the right:
// It can be also used to add or remove decimal numbers.
// Convert variable to a string:
dtostrf(DHT11Temperature, 3, 0, string1); // ( [variable] , [amount of digits we are going to use] , [amount of decimal digits] , [string name] )
// Convert Humidity into a string, so we can change the text alignment to the right:
// It can be also used to add or remove decimal numbers.
// Convert variable to a string:
dtostrf(DHT11Humidity, 3, 0, string2); // ( [variable] , [amount of digits we are going to use] , [amount of decimal digits] , [string name] )
// Convert Temperature 2 into a string, so we can change the text alignment to the right:
// It can be also used to add or remove decimal numbers.
// Convert variable to a string:
dtostrf(Temperature2, 3, 0, string3); // ( [variable] , [amount of digits we are going to use] , [amount of decimal digits] , [string name] )
///////////////////////////
///////// Display /////////
///////////////////////////
display.clearDisplay(); // Clear the display so we can refresh
// There are two screens we can show. Normal and IR Receiving mode.
// Normal shows information about the sensors.
// IR Receiving Mode is in a state that stores any IR remote control into the memory, and we show text information about that.
// Check button 1 is press to enter IR Receiving Mode:
if (StateOfButton1 == LOW) // If button 1 is depress
{
// Display text explaining that we are in IR Receiving mode:
display.setCursor(0, 0); // Set cursor position ( [Position-X] , [Position-Y] )
display.print("Press a button on any"); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(0, 8); // Set cursor position ( [Position-X] , [Position-Y] )
display.print("IR Remote Control"); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(0, 16); // Set cursor position ( [Position-X] , [Position-Y] )
display.print("to control the LEDs"); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(0, 24); // Set cursor position ( [Position-X] , [Position-Y] )
display.print("remotely."); // Print text or value. For printing text, use double quotes ("Text")
} else // If button 1 is not press, then go to normal display mode
{
// Display Temperature:
display.setCursor(0, 0); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("Temp: "); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(29, 0); // Set cursor position ( [Position-X] , [Position-Y] )
display.println(string1); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(46, -6); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("."); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(51, 0); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("C"); // Print text or value. For printing text, use double quotes ("Text")
// Display Humidity:
display.setCursor(0, 8); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("Hum: "); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(29, 8); // Set cursor position ( [Position-X] , [Position-Y] )
display.println(string2); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(51, 8); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("%"); // Print text or value. For printing text, use double quotes ("Text")
// Display Potentiometer:
display.setCursor(0, 16); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("Pot: "); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(35, 16); // Set cursor position ( [Position-X] , [Position-Y] )
display.println(PotentiometerValue); // Print text or value. For printing text, use double quotes ("Text")
//display.println(ThermistorValue); // Print text or value. For printing text, use double quotes ("Text")
// Display Light Sensor:
display.setCursor(0, 24); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("Light: "); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(35, 24); // Set cursor position ( [Position-X] , [Position-Y] )
display.println(LightSensorValue); // Print text or value. For printing text, use double quotes ("Text")
// Display Thermistor (Temperature 2):
display.setCursor(65, 0); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("Temp2: "); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(100, 0); // Set cursor position ( [Position-X] , [Position-Y] )
display.println(string3); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(117, -6); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("."); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(122, 0); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("C"); // Print text or value. For printing text, use double quotes ("Text")
// Display RGB Red:
display.setCursor(65, 8); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("Red: "); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(100, 8); // Set cursor position ( [Position-X] , [Position-Y] )
display.println(redIntensity); // Print text or value. For printing text, use double quotes ("Text")
// Display RGB Green:
display.setCursor(65, 16); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("Green: "); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(100, 16); // Set cursor position ( [Position-X] , [Position-Y] )
display.println(greenIntensity); // Print text or value. For printing text, use double quotes ("Text")
// Display RGB Blue:
display.setCursor(65, 24); // Set cursor position ( [Position-X] , [Position-Y] )
display.println("Blue: "); // Print text or value. For printing text, use double quotes ("Text")
display.setCursor(100, 24); // Set cursor position ( [Position-X] , [Position-Y] )
display.println(blueIntensity); // Print text or value. For printing text, use double quotes ("Text")
// Draw line:
display.drawLine(60, 0, 60, 32, WHITE); // Draw line (x0,y0,x1,y1,color)
} // End of if button 1 is not press, then go to normal display mode
display.display(); // Print everything we set previously into the display
////////////////////////////
////// Serial Monitor //////
////////////////////////////
// Print temperature and humidity from DHT11 in the Serial Monitor:
Serial.print(F("Temp: "));
spacepad(DHT11Temperature);
Serial.print(DHT11Temperature); // Print temperature
Serial.print("°C");
Serial.print(F(" Hum: "));
spacepad(DHT11Humidity);
Serial.print(DHT11Humidity); // Print humidity
Serial.print(F(" %"));
// Print light sensor value:
Serial.print(F(" Light: "));
zeropad(LightSensorValue);
Serial.print(LightSensorValue); // Print the value of the light sensor
// Print Thermistor value:
Serial.print(F(" Therm: "));
zeropad(ThermistorValue);
Serial.print(ThermistorValue); // Print value of the Thermistor
// Print temperature from the thermistor:
Serial.print(F(" Temp2: "));
spacepad(Temperature2);
Serial.print(Temperature2); // Print temperature
Serial.print(F("°C"));
// Print potentiometer value:
Serial.print(F(" Pot: "));
if (PotentiometerValue < 1000) Serial.print(F("0"));
zeropad(PotentiometerValue);
Serial.print(PotentiometerValue); // Print value of the potentiometer
//Serial.print(ThermistorValue); // Print value of the Thermistor
// Print RGB LED values:
Serial.print(F(" RGB: "));
zeropad(redIntensity);
Serial.print(redIntensity);
Serial.print(F(", "));
zeropad(greenIntensity);
Serial.print(greenIntensity);
Serial.print(F(", "));
zeropad(blueIntensity);
Serial.print(blueIntensity);
Serial.println(); // Create a new line
delay(10); // Wait this amount of milliseconds. 1000 milliseconds is 1 second
} // End of loop
void zeropad(int value) {
if (value < 100) Serial.print("0");
if (value < 10) Serial.print("0");
}
void spacepad(int value) {
if (value < 100) Serial.print(" ");
if (value < 10) Serial.print(" ");
}
diagram.json for wokwi
{
"version": 1,
"author": "Anonymous maker",
"editor": "wokwi",
"parts": [
{ "type": "wokwi-arduino-uno", "id": "uno", "top": 58.2, "left": -0.6, "attrs": {} },
{
"type": "wokwi-pushbutton",
"id": "btn1",
"top": -51.4,
"left": 268.8,
"attrs": { "color": "white" }
},
{
"type": "wokwi-pushbutton",
"id": "btn2",
"top": -99.4,
"left": 268.8,
"attrs": { "color": "yellow" }
},
{
"type": "wokwi-text",
"id": "legendservo1",
"top": -48,
"left": 297.6,
"attrs": { "text": "1" }
},
{
"type": "wokwi-text",
"id": "legendservo2",
"top": -96,
"left": 297.6,
"attrs": { "text": "2" }
},
{
"type": "wokwi-buzzer",
"id": "bz1",
"top": -146.7,
"left": 369.3,
"rotate": 90,
"attrs": { "volume": "0.1" }
},
{
"type": "wokwi-dht22",
"id": "dht1",
"top": -208.2,
"left": 287.1,
"rotate": 90,
"attrs": {}
},
{
"type": "wokwi-ir-receiver",
"id": "ir1",
"top": -255.78,
"left": 281.55,
"rotate": 90,
"attrs": {}
},
{ "type": "wokwi-rgb-led", "id": "rgb1", "top": -63.2, "left": 385.1, "attrs": {} },
{
"type": "wokwi-led",
"id": "led1",
"top": -61.2,
"left": 359.4,
"attrs": { "color": "red", "flip": "1" }
},
{
"type": "wokwi-led",
"id": "led2",
"top": -61.2,
"left": 416.6,
"attrs": { "color": "blue", "flip": "" }
},
{ "type": "wokwi-potentiometer", "id": "pot1", "top": 56.3, "left": 278.2, "attrs": {} },
{ "type": "wokwi-ir-remote", "id": "remote1", "top": -268.8, "left": -86.4, "attrs": {} },
{
"type": "wokwi-photoresistor-sensor",
"id": "ldr1",
"top": 124.5,
"left": 301.7,
"rotate": 90,
"attrs": {}
},
{
"type": "wokwi-ntc-temperature-sensor",
"id": "ntc1",
"top": 136.5,
"left": 402.7,
"rotate": 90,
"attrs": {}
},
{
"type": "board-ssd1306",
"id": "oled1",
"top": 185.54,
"left": -124.57,
"attrs": { "i2cAddress": "0x3c" }
}
],
"connections": [
[ "uno:2", "btn1:2.l", "green", [ "v0" ] ],
[ "uno:3", "btn2:2.l", "green", [ "v0" ] ],
[ "uno:GND.1", "btn1:1.l", "black", [ "v0" ] ],
[ "uno:GND.1", "btn2:1.l", "black", [ "v0" ] ],
[ "uno:GND.1", "bz1:1", "black", [ "v0" ] ],
[ "uno:5", "bz1:2", "green", [ "v0" ] ],
[ "uno:4", "dht1:SDA", "green", [ "v0" ] ],
[ "uno:6", "ir1:DAT", "green", [ "v0" ] ],
[ "dht1:GND", "uno:GND.1", "black", [ "h0" ] ],
[ "dht1:VCC", "uno:5V", "red", [ "h-182.4", "v432", "h82.6" ] ],
[ "ir1:VCC", "uno:5V", "red", [ "h-192", "v480", "h82.6" ] ],
[ "uno:GND.1", "ir1:GND", "black", [ "v0" ] ],
[ "uno:GND.1", "rgb1:COM", "black", [ "v-19.2", "h288.2" ] ],
[ "rgb1:R", "uno:9", "orange", [ "v19.2", "h-231.2" ] ],
[ "rgb1:G", "uno:10", "green", [ "v28.8", "h-258.6" ] ],
[ "rgb1:B", "uno:11", "blue", [ "v38.4", "h-277.4" ] ],
[ "led1:A", "uno:12", "green", [ "v48", "h0.4" ] ],
[ "led2:A", "uno:13", "blue", [ "v57.6", "h-326.4" ] ],
[ "uno:GND.1", "led1:C", "black", [ "v-19.2", "h259.5" ] ],
[ "uno:GND.1", "led2:C", "black", [ "v-19.2", "h307.5" ] ],
[ "pot1:GND", "uno:GND.2", "black", [ "v153.6", "h-138.3" ] ],
[ "pot1:VCC", "uno:5V", "red", [ "v144", "h-167.8" ] ],
[ "pot1:SIG", "uno:A0", "gold", [ "v163.2", "h-109.8" ] ],
[ "ldr1:VCC", "uno:5V", "red", [ "v28.8", "h-243.8" ] ],
[ "ldr1:GND", "uno:GND.2", "black", [ "v38.4", "h-224.3" ] ],
[ "ldr1:AO", "uno:A1", "gold", [ "v57.6", "h-156.8" ] ],
[ "ntc1:VCC", "uno:5V", "red", [ "v28.8", "h-307.2" ] ],
[ "ntc1:GND", "uno:GND.2", "black", [ "v38.4", "h-297.6" ] ],
[ "ntc1:OUT", "uno:A2", "gold", [ "v67.2", "h-211.1" ] ],
[ "oled1:SDA", "uno:A4", "blue", [ "v-19.2", "h0.07" ] ],
[ "oled1:SCL", "uno:A5", "orange", [ "v-28.8", "h326.7" ] ],
[ "oled1:VCC", "uno:5V", "red", [ "v-48", "h153.75", "v124.8", "h82.6" ] ],
[ "oled1:GND", "uno:GND.2", "black", [ "v-38.4", "h172.8", "v124.8", "h76.8" ] ]
],
"dependencies": {}
}
libraries.txt for wokwi
# Wokwi Library List
# See https://docs.wokwi.com/guides/libraries
# Automatically added based on includes:
Adafruit GFX Library
DHTlib
IRremote
Adafruit SSD1306

