//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
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
led1:A
led1:C
dht1:VCC
dht1:SDA
dht1:NC
dht1:GND
r1:1
r1:2