/* Layar LCD */
#include <LiquidCrystal.h>
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

/* Sensor suhu dan kelembaban */
#include <DHT.h>
#define datapin 7 //Pin digital koneksi DHT22
#define DHTTYPE DHT22
DHT dht (datapin, DHTTYPE);

void setup(){
  dht.begin();
  lcd.begin(16, 2);
}

void loop(){

 /*  pembacaan data suhu dan kelembaban */
 float air_temp = dht.readTemperature();
 float humidity = dht.readHumidity();

 /* Tampilkan data suhu dan kelembaban di layar LCD */ 
 lcd.setCursor(0,0);
 lcd.print(String("Suhu ") + String(air_temp));
 lcd.setCursor(0,1);
 lcd.print(String("Kelembaban ") + String(humidity));

 delay(2000);

}