#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define DHTPIN 10
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHT22);
float hum;
float temp;
LiquidCrystal_I2C lcd(0x27,20,4);
void setup(){
Serial.begin(9600);
dht.begin();
Serial.print("Suhu dan Kelembaban");
lcd.init();
lcd.setCursor(5,0);
lcd.print("Informasi");
}
void loop(){
hum = dht.readHumidity();
temp = dht.readTemperature();
Serial.print("suhu");
Serial.print(temp);
Serial.println("*c");
lcd.init();
lcd.setCursor(0,0);
lcd.print("Yafi");
lcd.setCursor(0,1);
lcd.print("suhu=");
lcd.setCursor(6,1);
lcd.print(temp);
lcd.setCursor(12,1);
lcd.print("*c");
lcd.setCursor(0,2);
lcd.print("kelembaba=");
lcd.setCursor(12,2);
lcd.print(hum);
delay(3000);
}