#include <LiquidCrystal_I2C.h>
#include <DHT.h>
DHT dht(2, DHT22); //Pin, Jenis DHT
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
Serial.begin(9600);
dht.begin();
lcd.init();
lcd.backlight();
}
void loop() {
float kelembaban = dht.readHumidity();
float suhu = dht.readTemperature();
lcd.setCursor(0, 0);
lcd.print("kelembaban: ");
lcd.setCursor(0, 1);
lcd.print(kelembaban);
lcd.setCursor(0, 2);
lcd.print("suhu: ");
lcd.setCursor(0, 3);
lcd.print(suhu);
Serial.print("kelembaban: ");
Serial.print(kelembaban);
Serial.print(" ");
Serial.print("suhu: ");
Serial.println(suhu);
delay(1000);
}