Sorry, my mistake.
void loop()
{
// current time;
unsigned long currentTime = millis();
// start time of read delay
static unsigned long startTime = 0;
// humidity, tempC, tempF
float h, t, f;
// if delay not started, start delay and read dht
if (startTime == 0)
{
// set the start time
startTime = currentTime;
// read dht
h = dht.readHumidity();
t = dht.readTemperature();
f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f))
{
Serial.println("Failed to read from DHT sensor!");
return;
}
}
// if delay lapsed
else if(currentTime - startTime > 5000)
{
// reset start time
startTime = 0;
}
your other code
...
...
}