print("Hello, ESP32!")
import machine
import dht
import time
import _thread
#declarando que o sensor está no pino 15 e é uma entrada
sensor = dht.DHT22(machine.Pin(15))
def thread_func():
while True:
#Recebendo as mediçoes do sensor
sensor.measure()
time.sleep(5)
#Imprimindo as temperaturas
print("A temperatura atual é:", sensor.temperature())
print("A temperatura atual é:", sensor.humidity())
_thread.start_new_thread(thread_func,());