hi, i have a loop for reading the dht11 sensor for temperature and humidity.
i tried first the temperature the code below
dht11 DHT11;
DHT11.read(48);
Serial.println(DHT11.temperature);
if (temp>=DHT11.temperature) {digitalWrite(52,LOW);}
else {digitalWrite(52,HIGH);}
where the ''temp'' is a number on eeprom, as a setting to activate a relay
but with this code, the relay is open and closed , always.
i read at println the values below
23297
29
14
23297
28
23297
29
23297
29
23297
29
23297
29
23297
only the ''29'' values are correct, i am wondering what are the others?
after that, i added a delay like this below
dht11 DHT11;
DHT11.read(48);
delay(200);
Serial.println(DHT11.temperature);
if (temp>=DHT11.temperature) {digitalWrite(52,LOW);}
else {digitalWrite(52,HIGH);}
for values of delay, below 200ms, the incoming values are very different .
by adding the delay, i get only the 29 degrees celcius, the correct.
i am wondering , why is this happened?