print("Hello, ESP32!")
from machine import Pin
import machine
import dht
import time
d = dht.DHT22(machine.Pin(23))
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,'%')
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()