This commit is contained in:
robert 2021-02-15 23:27:34 +01:00
parent 36dfe0b9c9
commit c436d68a20

View File

@ -48,7 +48,7 @@ while True:
# Get Temperature from DHT # Get Temperature from DHT
_, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN) _, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
print("temperature before cut: " + temperature) print("temperature before cut: " + str(temperature))
# cut temperature to xx.xx if more then tow digits after "." # cut temperature to xx.xx if more then tow digits after "."
t_split = temperature.split(".") t_split = temperature.split(".")
if len(t_split[1]) > 2: if len(t_split[1]) > 2:
@ -56,7 +56,7 @@ while True:
t_split[1] = t_split[1][:-t_cut] t_split[1] = t_split[1][:-t_cut]
temperature = t_split[0] + "." + t_split[1] temperature = t_split[0] + "." + t_split[1]
print("temperature after cut: " + str(temperature)) print("temperature after cut: " + temperature)
# Get Humidity from DHT # Get Humidity from DHT
humidity, _ = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN) humidity, _ = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)