#include <DHT.h>;
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#define DHTPIN 7
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27,16,2);
int cek;
float hum; //kelembaban
float temp; //suhu
void setup()
{
lcd.init();
Serial.begin(9600);
dht.begin();
lcd.backlight();
lcd.setBacklight(HIGH);
}
void loop()
{
delay(2000);
hum = dht.readHumidity();
temp= dht.readTemperature();
lcd.setCursor(0,0);
lcd.print("Humidity: ");
lcd.print(hum);
lcd.print("%");
lcd.setCursor(0,1);
lcd.print("Temp: ");
lcd.print(temp);
lcd.println("C");
Serial.print("Humidity: ");
Serial.print(hum);
Serial.print(" %, Temp: ");
Serial.print(temp);
Serial.println(" Celsius");
delay(10000);
}