from machine import Pin
from time import sleep
import dht
print("Working!")
LEDPIN = 32
LEDPIN2 = 33
pin = Pin(LEDPIN, Pin.OUT)
pin2 = Pin(LEDPIN2, Pin.OUT)
sensor = dht.DHT22(Pin(4))
while True:
sensor.measure()
temp = sensor.temperature()
humid = sensor.humidity()
sleep(1)
if temp >= 40:
pin.on()
else:
pin.off()
if humid >= 20:
pin2.on()
else:
pin2.off()
print(temp)
print(humid)