// #include <DHT.h>
// #define DHT_PIN 7
// #define DHTTYPE DHT22
// DHT dhtObject(DHT_PIN, DHTTYPE);
// float Hum;
// float Temp;
// void setup() {
// // put your setup code here, to run once:
// Serial.begin(115200);
// dhtObject.begin();
// }
// void loop() {
// // put your main code here, to run repeatedly:
// Hum=dhtObject.readHumidity();
// Temp=dhtObject.readTemperature();
// Serial.print("Temperature:");
// Serial.println(Temp);
// Serial.print("Humidity:");
// Serial.println(Hum);
// delay(1000);
// }
// #include <LiquidCrystal_I2C.h>
// LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x3F for a 16 chars and 2 line display
// byte Heart[8] = {
// 0b00000,
// 0b01010,
// 0b11111,
// 0b11111,
// 0b01110,
// 0b00100,
// 0b00000,
// 0b00000
// };
// void setup() {
// lcd.init();
// lcd.clear();
// lcd.backlight(); // Make sure backlight is on
// // Print a message on both lines of the LCD.
// // lcd.setCursor(2,0); //Set cursor to character 2 on line 0
// // lcd.print("Hello worldddddddddddddddddddddddddddddddddddddddddddddddd!");
// // lcd.scrollDisplayLeft();
// // // lcd.setCursor(2,1); //Move cursor to character 2 on line 1
// // lcd.print("LCD Tutorial");
// lcd.setCursor(2,0);
// lcd.createChar(0, Heart);
// }
// void loop() {
// lcd.setCursor(2,0); //Set cursor to character 2 on line 0
// lcd.print("Hello worldddddddddddddddd!");
// lcd.scrollDisplayRight();
// }
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x3F for a 16 chars and 2 line display
// make some custom characters:
byte Heart[8] = {
0b00000,
0b01010,
0b11111,
0b11111,
0b01110,
0b00100,
0b00000,
0b00000
};
byte Bell[8] = {
0b00100,
0b01110,
0b01110,
0b01110,
0b11111,
0b00000,
0b00100,
0b00000
};
byte Alien[8] = {
0b11111,
0b10101,
0b11111,
0b11111,
0b01110,
0b01010,
0b11011,
0b00000
};
byte Check[8] = {
0b00000,
0b00001,
0b00011,
0b10110,
0b11100,
0b01000,
0b00000,
0b00000
};
byte Speaker[8] = {
0b00001,
0b00011,
0b01111,
0b01111,
0b01111,
0b00011,
0b00001,
0b00000
};
byte Sound[8] = {
0b00001,
0b00011,
0b00101,
0b01001,
0b01001,
0b01011,
0b11011,
0b11000
};
byte Skull[8] = {
0b00000,
0b01110,
0b10101,
0b11011,
0b01110,
0b01110,
0b00000,
0b00000
};
byte Lock[8] = {
0b01110,
0b10001,
0b10001,
0b11111,
0b11011,
0b11011,
0b11111,
0b00000
};
void setup()
{
lcd.init();
// Make sure backlight is on
lcd.backlight();
// create a new characters
lcd.createChar(0, Heart);
lcd.createChar(1, Bell);
lcd.createChar(2, Alien);
lcd.createChar(3, Check);
lcd.createChar(4, Speaker);
lcd.createChar(5, Sound);
lcd.createChar(6, Skull);
lcd.createChar(7, Lock);
// Clears the LCD screen
lcd.clear();
// Print a message to the lcd.
lcd.print("Custom Character");
}
// Print All the custom characters
void loop()
{
lcd.setCursor(0, 1);
lcd.write(0);
lcd.setCursor(2, 1);
lcd.write(1);
lcd.setCursor(4, 1);
lcd.write(2);
lcd.setCursor(6, 1);
lcd.write(3);
lcd.setCursor(8, 1);
lcd.write(4);
lcd.setCursor(10, 1);
lcd.write(5);
lcd.setCursor(12, 1);
lcd.write(6);
lcd.setCursor(14, 1);
lcd.write(7);
}
//The output appears as shown.