//Belajar Arduino kelas XI
#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.println("Informasi 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();
//suhu
lcd.setCursor(2,1);
lcd.print("suhu");
lcd.setCursor(7,1);
lcd.print(temp);
lcd.setCursor(13,1);
lcd.print("*C");
//kelembaban
lcd.setCursor(2,2);
lcd.print("kelembaban");
lcd.setCursor(14,2);
lcd.print(hum);
delay(3000);
}