Skip to content

Commit daca831

Browse files
authored
Merge pull request #102 from FoamyGuy/dht11_decimal
Read decimal value also for dht11
2 parents a6e6c63 + e561725 commit daca831

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_dht.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ def measure(self) -> None:
235235
if self._dht11:
236236
# humidity is 1 byte
237237
new_humidity = buf[0]
238-
# temperature is 1 byte
239-
new_temperature = buf[2]
238+
# temperature is 1 byte for integral and 1 byte for 1st decimal place
239+
new_temperature = buf[2] + (buf[3] & 0x0F) / 10
240240
else:
241241
# humidity is 2 bytes
242242
new_humidity = ((buf[0] << 8) | buf[1]) / 10

0 commit comments

Comments
 (0)