#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//https://wokwi.com/projects/363616304245394433
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(9600);
dht.begin();
lcd.init();
lcd.backlight();
}
void loop() {
delay(1000);
float h = dht.readHumidity();
float t = dht.readTemperature();
lcd.setCursor(0, 0);
lcd.print("TEMP: ");
lcd.print(t);
lcd.setCursor(0, 1);
lcd.print("HUMI: ");
lcd.print(h);
Serial.print("Humidity: ");
Serial.print(h, 1);
Serial.print("% Temperature: ");
Serial.print(t, 1);
Serial.println("C ");
}