#include <DHT.h>
#define DHTPIN 12
#define DHTTYPE 22
DHT dht(DHTPIN, DHTTYPE);
const int relay = 11;
void setup() {
Serial.begin(9600);
Serial.print("Control relay temp sensor ");
dht.begin();
pinMode(relay, OUTPUT);
}
void loop() {
temp();
}
void temp(){
float Read_temp = dht.readTemperature();
if(Read_temp > 37){
digitalWrite(relay, HIGH);
}else{
digitalWrite(relay, LOW);
}
delay(1000);
Serial.print("Temp = ");
Serial.print(Read_temp);
Serial.println(" C");
}