int threshold = 25;
#include <DHT.h>
#define DHTPIN 9
#define DATATYPE DHT22
DHT dht(DHTPIN,DATATYPE);
float Celsius = 0;
void setup() {
Serial.begin(9600);
dht.begin();
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode(11,OUTPUT);
}
int flag = 0;
void loop() {
float t = dht.readTemperature();
// delayMicroseconds(100);
if(flag == 0)
{ if(t < threshold){
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
delay(5000);
}
if(t > threshold){
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
delay(5000);
}
flag = 1;}
if(flag ==1){
digitalWrite(12, LOW);
digitalWrite(13, LOW);
}
// delay(3000);
}