//#include <ArduinoJson.h>
//#include <Adafruit_Sensor.h>
//#include <DHT.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd (0x27,16,2);
// #define DHTPIN 10
// #define DHTTYPE DHT22
// #define motor 3
DHT dht(DHTPIN, DHTTYPE);
void setup() {
lcd.init();
lcd.backlight();
lcd.print("Mengukur suhu dan kelembaban dengan sensor DHT22...");
dht.begin();
}
void loop() {
delay(2000);
float suhu = dht.readTemperature();
float kelembaban = dht.readHumidity();
// Memeriksa apakah pembacaan sukses
if (isnan(suhu) || isnan(kelembaban)) {
lcdprintln("Gagal membaca dari sensor DHT22!");
} else {
lcd.print("Suhu: ");
lcd.print(suhu);
lcd.print(" °C, Kelembaban: ");
lcd.print(kelembaban);
lcd.println(" %");
}
}