Skip to content

Commit

Permalink
read decimal value also
Browse files Browse the repository at this point in the history
  • Loading branch information
FoamyGuy committed Nov 13, 2024
1 parent a6e6c63 commit e561725
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 e561725

Please sign in to comment.