#include<DHT.h>
#define DHTPIN 12          //Digital pin connected to DHT Sensor
#define DHTTYPE DHT22      //DHT22 (AM2302), Am2321
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);   
  pinMode(2, OUTPUT);              //Serial Terminal and speed is 9600
  Serial.println("DHTxx test!");    //Starts Sensing
  dht.begin();
}

void loop() {
  delay(2000);
  float h = dht.readHumidity();              // Reading temperature or humidity takes about 250 milliseconds!
  float t = dht.readTemperature();           // Read temperature as Celsius (the default)
  float f = dht.readTemperature(true);       // Read temperature as Fahrenheit (isFahrenheit = true)

// Check if any reads failed and exit early (to try again)
if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }

  float hif = dht.computeHeatIndex(f, h);          // Compute heat index in Fahrenheit (the default)
  
  float hic = dht.computeHeatIndex(t, h, false);   // Compute heat index in Celsius (isFahreheit = false)
   
  if(t>70) {
    digitalWrite(2, HIGH);
  }
  else{
    digitalWrite(2, LOW);
  }
}