#include <DHTesp.h>  
int DHT_PIN = 18;  
int LED_PIN = 25; 
DHTesp dhtSensor;

void setup() 
{
  
  Serial.begin(115200);
  pinMode(25, INPUT);
  pinMode(25, OUTPUT); 
  dhtSensor.setup(DHT_PIN, DHTesp::DHT22);  
}

void loop() 
{
  
  TempAndHumidity data = dhtSensor.getTempAndHumidity(); 
  float tmp = data.temperature;

  Serial.println("Temp: " + String(data.temperature, 2) + "*C");   
  Serial.println("Humidity: " + String(data.humidity, 2) + "%");  
  Serial.println("---");
  
  if (tmp >= 40) 
  {
    digitalWrite(LED_PIN, HIGH);
    delay(500);
  }
  else 
  {
    digitalWrite(LED_PIN, LOW);
  }

  delay(500); 
}