from machine import Pin
import machine
import dht
import time
d = dht.DHT22(machine.pin(23))#senser dht
led1 = Pin(2, Pin.out)
led2 = Pin(4, Pin.out)
led3 = Pin(5, Pin.out)
while True:
d.measure()
temp = d.temperature()
humid = d.humidity()
print('temperature: ',temp,'c')
print('humidity: ',humid,'x')
time.sleep(0.5)
if temp <= 10 and humid <= 35:
led1.on()
led2.off()
led3.off()
elif temp <= 25 and humid <= 75:
led1.off()
led2.on()
led3.off()
elif temp > 25 and humid > 75:
led1.off()
led2.off()
led3.on()
else
led1.off()
led2.off()
led3.off()