Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

MicroPython • Re: Pi Pico W - DHT11 - wrong number of pulses ONLY after 2 reads

$
0
0
This is obviously untested, but perhaps you could modify the library code to return BOTH temperature and humidity in a single step, so that you halve the number of times you have to access the sensor by calling the DHT11.measure() method. That would remove the need to wait between getting readings of the two quantities.

Something like -

Code:

     @property    def temp_and_hum(self):        self.measure()        return self._temperature, self._humidity
Then in the outer 'application' code perhaps you would call that as -

Code:

t, h = sensor.temp_and_hum()

Statistics: Posted by B.Goode — Wed Jan 31, 2024 1:57 pm



Viewing all articles
Browse latest Browse all 8082

Trending Articles