Skip to content

Commit

Permalink
Merge pull request #102 from FoamyGuy/dht11_decimal
Browse files Browse the repository at this point in the history
Read decimal value also for dht11
  • Loading branch information
FoamyGuy authored Nov 20, 2024
2 parents a6e6c63 + e561725 commit daca831
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adafruit_dht.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ def measure(self) -> None:
if self._dht11:
# humidity is 1 byte
new_humidity = buf[0]
# temperature is 1 byte
new_temperature = buf[2]
# temperature is 1 byte for integral and 1 byte for 1st decimal place
new_temperature = buf[2] + (buf[3] & 0x0F) / 10
else:
# humidity is 2 bytes
new_humidity = ((buf[0] << 8) | buf[1]) / 10
Expand Down

0 comments on commit daca831

Please sign in to comment.