Hi guys, hope that you can help me with my issue. I'm trying to read DH11 sensor inside a nested do...while loop inserted into void loop function. What I'm trying to do is to execute the rest of the code only if the temperature changes. The problem is that the temperature inside nested loop is always the same (not changing and it's the same number as when code runs for the first time). Here's the code:
void loop(){
DHT.read11(dht_dpin);
temp = DHT.temperature;
hum = DHT.humidity;
int temp2;
do{
delay(1000);
temp2 = DHT.temperature;
}while(temp == temp2);
temp = temp2;
//rest of the code goes here