#include <LiquidCrystal_I2C.h>
#include <TinyDHT.h> // Include the DHT library for humidity sensor
#define DHTTYPE DHT22
#define TEMPTYPE 0 // Use Fahrenheit (0 for celsius)
#define DHTPIN 1
DHT dht(DHTPIN, DHTTYPE); // Define Temp Sensor
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
dht.begin(); // Initialize DHT Teperature Sensor
lcd.init(); // initialize the lcd
lcd.backlight(); // Turn on the backlight
lcd.setCursor(0,0); //Set cursor to char 0, line 0
lcd.print("Temp:");
lcd.setCursor(0,1); //Move cursor to char 0, line 1
lcd.print("Humidity:");
}
void loop()
{
int8_t h = dht.readHumidity(); // Read humidity
int16_t t = dht.readTemperature(TEMPTYPE); // read temperature
lcd.setCursor(10,0);
lcd.print(t); lcd.print(" C");
lcd.setCursor(10,1);
lcd.print(h); lcd.print("%");
delay(1000);
}