from machine import Pin, PWM
import dht
import time
#40 graus muito quente
def angulo(a):
pwm.duty((a*(123-24))//180+24);
sensor = dht.DHT22(Pin(15))
pwm = PWM(Pin(13,Pin.OUT), freq=50)
while True:
sensor.measure()
t = sensor.temperature()
u = sensor.humidity()
print(f"Temp{t}. Umid={u}")
if t > 40:
angulo(90)
else:
angulo(0)
time.sleep(1)