//Belajar Arduino kelas XI
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define DHTPIN 10
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHT22);
LiquidCrystal_I2C lcd(0x27,20,4);
float hum;
float temp;
void setup() {
Serial.begin(9600);
dht.begin();
lcd.init();
//lcd.backlight();
lcd.setCursor(6,0);
lcd.print("Informasi");
lcd.setCursor(2,1);
lcd.print("Suhu & Kelembaban");
lcd.setCursor(8,2);
lcd.print("oleh");
lcd.setCursor(5,3);
lcd.print("Kelas 11 TKJ");
delay(3000);
lcd.clear();
}
void loop() {
hum = dht.readHumidity();
temp = dht.readTemperature();
lcd.init();
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("Informasi Suhu");
lcd.setCursor(0,1);
lcd.print("SMK Muh 1 Yogyakarta");
//suhu
lcd.setCursor(0,2);
lcd.print("Suhu :");
lcd.setCursor(13,2);
lcd.print(temp);
lcd.setCursor(19,2);
lcd.print("C");
//kelembaban
lcd.setCursor(0,3);
lcd.print("Kelembaban :");
lcd.setCursor(13,3);
lcd.print(hum);
lcd.setCursor(19,3);
lcd.print("%");
delay(5000);
//lcd.clear();
}