#Nombre: Kevin Bermeo
#Fecha: 16/7/2025
import time
import dht
from machine import Pin,ADC
sensor=dht.DHT22(Pin(0))
Rojo=Pin(2,Pin.OUT)
Amarillo=Pin(8,Pin.OUT)
Azul=Pin(15,Pin.OUT)
Buzz=Pin(17,Pin.OUT)
humedadA=False
humedadB=False
while True:
sensor.measure()
temp=sensor.temperature()
hum=sensor.humidity()
print(f"La Temperatura es: {temp}\nla humedad es: {hum}")
if (28<temp<=35):
Rojo.on()
else:
Rojo.off()
if 70<hum<=100 and not humedadA:
for i in range(3):
Buzz.on()
time.sleep(0.5)
Buzz.off()
time.sleep(0.1)
humedadA = True
else:
Buzz.off()
if (23<temp<=27):
Amarillo.on()
else:
Amarillo.off()
if (5<temp<=22):
Azul.on()
else:
Azul.off()
if 0<hum<=40 and not humedadB:
for i in range(1):
Buzz.on()
time.sleep(0.5)
Buzz.off()
time.sleep(0.1)
humedadB = True
else:
Buzz.off()
time.sleep(1)