//Quiz 1 Pertemuan ke-4

#include <DHTesp.h>;

#define DHTPIN 15
const int pinLED = 23;
const float batasan = 40.00;


DHTesp dht;

void setup() {
  // put your setup code here, to run once:
 
  Serial.begin(115200);
  Serial.println("Hello, ESP32!");

  dht.setup(DHTPIN, DHTesp::DHT22);

pinMode(pinLED, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  TempAndHumidity data = dht.getTempAndHumidity();
  
  //extrak
  float temp = data.temperature;
   //extrak
  float hum = data.temperature;
 Serial.println(" Suhu Saat ini   " + String(temp,2));
 Serial.println("Batas Suhu  " + String(batasan));
  
 
  if(temp > batasan ){
     digitalWrite(pinLED, HIGH);
     delay(1000); // this speeds up the simulation
     digitalWrite(pinLED, LOW);
     delay(1000); // this speeds up the simulation
  }else{
     Serial.println("Normal Suhu Saat Ini " + String(temp,2));
  
  }

  delay(5000); // this speeds up the simulation


}