diff --git a/adafruit_dht.py b/adafruit_dht.py index e7e8595..e4842c3 100644 --- a/adafruit_dht.py +++ b/adafruit_dht.py @@ -138,7 +138,11 @@ def measure(self): delay_between_readings = 0.5 if self._dht11: delay_between_readings = 1.0 - if time.monotonic()-self._last_called > delay_between_readings: + # Initiate new reading if this is the first call or if sufficient delay + # If delay not sufficient - return previous reading. + # This allows back to back access for temperature and humidity for same reading + if (self._last_called == 0 or + (time.monotonic()-self._last_called) > delay_between_readings): self._last_called = time.monotonic() pulses = self._get_pulses()