print("Hello, ESP32!")
import dht
import time
from machine import Pin
led1 = Pin(2, Pin.OUT)
pir = Pin(13, Pin.IN)
led2 = Pin(22, Pin.OUT)
sensor = dht.DHT22(Pin(14))
while True:
led1.on()
time.sleep(1)
led1.off()
time.sleep_ms(1000)
sensor.measure()
temperatura = sensor.temperature()
humidade = sensor.humidity()
print(pir.value())
led2.value(pir.value())
print(temperatura)
print(humidade)
if temperatura >= 24:
led2.on()
time.sleep(1)
led2.off()