#include <DHTesp.h>
DHTesp dhtSensor;
TempAndHumidity data;
int DHT_PIN = 15;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
dhtSensor.setup(DHT_PIN, DHTesp::DHT22);
pinMode(5, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
data = dhtSensor.getTempAndHumidity();
Serial.println("Humi : " + String(data.humidity));
Serial.println("Temp : " + String(data.temperature));
Serial.println("-----------------");
if(data.temperature>50){
digitalWrite(5, HIGH);
delay(1000);
}
else{
digitalWrite(5, LOW);
delay(1000);
}
//delay(10); // this speeds up the simulation
}