#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
float hum, temp;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
dht.begin();
}
void loop() {
// put your main code here, to run repeatedly:
temp = dht.readTemperature();
Serial.print(F("% Temperature: "));
Serial.println(temp);
delay(1000);
hum = dht.readHumidity();
Serial.print(F("%Humidity: "));
Serial.println(hum);
delay(250);
if (temp > 22) {
digitalWrite(7, HIGH);
}
else {
digitalWrite(7,LOW);
}
}