import time
from machine import Pin
import dht
ledt=Pin(27,Pin.OUT)
ledh=Pin(14,Pin.OUT)
dp=Pin(12)
d=dht.DHT22(dp)
while True:
d.measure()
temp=d.temperature()
hum=d.humidity()
if (temp>hum):
ledt.on()
time.sleep(0.2)
ledt.off()
ledh.off()
else:
ledt.off()
ledh.on()
time.sleep(0.2)
ledh.off()
print("temp:",temp)
print("humidity:",hum)