from machine import Pin
from time import sleep
import dht
led = Pin(12, Pin.OUT)
button = Pin(14,Pin.IN, Pin.PULL_DOWN)
dht22 = dht.DHT22(Pin(23))
print(button.value())
while True:
try:
dht22.measure()
temp = dht22.humidity()
led.value(button.value())
print(button.value())
print("Suhu =",temp," Lembab = ",hum,end="\n")
sleep(1)
except OSError as e:
print(e)