#include <DHT.h>; //ganti tanda petik dobel dengan tanda buka kurung lancip
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

#define DHTPIN 4
#define DHTTYPE DHT22

const int led = 3;
DHT dht(DHTPIN, DHTTYPE); 
LiquidCrystal_I2C lcd (0x27,16,2);

float hum;
float temp;

void kipas (){


  if (temp > 30){
    digitalWrite (led,HIGH);
  } else if (temp < 30){
    digitalWrite (led,LOW);
  }
}

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

void loop()
{  
    hum = dht.readHumidity();
    temp= dht.readTemperature();
    
    lcd.setCursor(0,0);
    lcd.print("Humidity: ");
    lcd.setCursor(10,0);
    lcd.print(hum) ;
    lcd.setCursor(0,1);
    lcd.print("Temp: ");
    lcd.setCursor(6,1);
    lcd.print(temp);
    delay(500);  
kipas ();
}