Closed
Description
Hello Adafruit Devs,
I would like to report a problem dealing with DHT11 sensor readings using your library. It seems that the decimals for the temperature are missing. I'm only getting temperatures without decimal precision (it is always 0).
Here is the minimal code to reproduce the issue:
import time
import board
import adafruit_dht
sensor = adafruit_dht.DHT11(board.D17)
while True:
try:
temperature = sensor.temperature
humidity = sensor.humidity
print(f"Temp: {temperature:.2f} °C, Hum: {humidity:.2f} %")
except RuntimeError as e:
print(f"Reading from DHT failure: {e.args[0]}")
time.sleep(2)
continue
except Exception as e:
sensor.exit()
raise e
time.sleep(2)
I'm getting this output always:
Temp: 28.00 °C, Hum: 64.00 %
Temp: 27.00 °C, Hum: 64.00 %
Temp: 28.00 °C, Hum: 64.00 %
Metadata
Metadata
Assignees
Labels
No labels