#include <DHT.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
#define DHTPIN 3
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
// Custom symbols for temperature and humidity
byte customSymbol1[8] = {
B00100,
B00100,
B00100,
B01110,
B10001,
B10001,
B01010,
B00100
};
byte customSymbol2[8] = {
B01110,
B00100,
B01110,
B00100,
B01110,
B00100,
B01110,
B00100
};
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
dht.begin();
// Create and display custom symbols
lcd.createChar(0, customSymbol1); // Use index 0 for the first custom symbol
lcd.setCursor(0, 0);
lcd.write(byte(0));
lcd.createChar(1, customSymbol2); // Use index 1 for the second custom symbol
lcd.setCursor(0, 1);
lcd.write(byte(1));
}
void loop() {
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
lcd.setCursor(0, 0);
lcd.print("Hum: ");
lcd.write(byte(0)); // Display the first custom symbol for humidity
lcd.print(h);
lcd.print("%");
lcd.setCursor(0, 1);
lcd.print("Temp: ");
lcd.write(byte(1)); // Display the second custom symbol for temperature
lcd.print(t);
lcd.print("*C");
}