import time
import board
import adafruit_dht
dht = adafruit_dht.DHT11(board.GP5)
while True:
try:
hum = dht.humidity
temp = dht.temperature # Celsius
# Soros monitor (szöveges)
print(f"RH = {hum:.0f} %")
# Mu plotter (címke:érték formátum)
print(f"temp:{temp:.1f}")
except RuntimeError as e:
# DHT-knél normális, hogy néha hibázik egy olvasás
print("Read error, retrying...")
time.sleep(2) # DHT11-nél tarts legalább ~1s mintavételi időt