From e561725f97c9d2f3b4956e2b6d8c1d57741932f2 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 13 Nov 2024 15:16:21 -0600 Subject: [PATCH] read decimal value also --- adafruit_dht.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_dht.py b/adafruit_dht.py index d4d869a..5c6f882 100644 --- a/adafruit_dht.py +++ b/adafruit_dht.py @@ -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