#include "DHTesp.h"
#include <LiquidCrystal_I2C.h>
#define DHTPIN 13
DHTesp dht;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
dht.setup(DHTPIN, DHTesp::DHT22);
lcd.init();
lcd.backlight();
}
void loop() {
TempAndHumidity data = dht.getTempAndHumidity();
// Menampilkan Suhu ke LCD
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Suhu saat ini");
lcd.setCursor(0,1);
lcd.print(String(data.temperature,2));
lcd.setCursor(5,1);
lcd.write(B11011111); //simbol derajat
lcd.setCursor(6,1);
lcd.print("C");
delay(2000);
// Menampilkan Kelembaban ke LCD
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Kelembaban skr");
lcd.setCursor(0,1);
lcd.print(String(data.humidity,2));
lcd.setCursor(6,1);
lcd.print("%");
delay(2000);
}