Reading sensor in do...while loop

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

Try calling DHT.read11(dht_dpin); in the while loop.

Do NOT use delay(). Have a look at how millis() is used to manage timing without blocking in several things at a time

In general do not use WHILE or FOR loops that take more than a few microseconds to complete. Allow the loop() function to do the repetition.

...R
Planning and Implementing a Program

Power_Broker:
Try calling DHT.read11(dht_dpin); in the while loop.

Yes! I missed that step. Thank you!