#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
int led = 11;
void setup()
{
  Serial.begin(115200);
  //Serial.println(F("DHT22 example!"));
  dht.begin();
  pinMode(led, OUTPUT);
}
void loop()
{
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();
  if (isnan(temperature) || isnan(humidity))
  {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }
  Serial.print(F("Humidity:"));
  Serial.print(humidity);
  Serial.print(F("% Temperature:"));
  Serial.print(temperature);
  Serial.println(F(" °c"));
  delay(2000);
  if (temperature >= 30.00)
  {
    digitalWrite(led, HIGH);
    Serial.println(" led on ");
    delay(1000);
  }
  else
  {
    digitalWrite(led, LOW);
    Serial.println(" led off ");
    delay(1000);
  }
}