#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define DHTPIN 10
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHT22);
LiquidCrystal_I2C lcd(0x27,20,4);
int chk;
float hum;
float temp;

void setup() {
  Serial.begin(9600);
  dht.begin();
  lcd.init();
  lcd.backlight();
  lcd.setCursor(4,0);
  lcd.print("Mengukur");
  lcd.setCursor(0,1);
  lcd.print("Suhu & Kelembaban");
  lcd.setCursor(0,2);
  lcd.print("*Muhammad Ridho Hisyam");
  lcd.setCursor(0,3);
  lcd.print("*1911102441136");
  delay(3000);
  lcd.clear();
}

void loop() {
 hum = dht.readHumidity();
 temp = dht.readTemperature();
  lcd.init();
  lcd.backlight();
  lcd.setCursor(2,0);
  lcd.print("Suhu & Kelembaban");
  //suhu
  lcd.setCursor(0,1);
  lcd.print("Suhu       :");
  lcd.setCursor(13,1);
  lcd.print(temp);
  lcd.setCursor(19,1);
  lcd.print("C");
  //kelembaban
  lcd.setCursor(0,2);
  lcd.print("Kelembaban :");
  lcd.setCursor(13,2);
  lcd.print(hum);
  lcd.setCursor(19,2);
  lcd.print("%");
  
  lcd.setCursor(0,3);
  lcd.print("By:Muhammad Ridho Hisyam");
  // delay(1000);
  // lcd.clear();
  
}