#DHT11 Digital Temperature and Humidity Sensor
from machine import Pin
from time import sleep_ms
import dht
d = dht.DHT11(Pin(23))
while True:
try:
d.measure()
temp = d.temperature() #( ํC)
humid = d.humidity() #(% RH)
print('Temp:', temp, ' Humid:', humid)
sleep_ms(1000)
except OSError as e:
print('Failed to read sensor!')
Loading
esp32-devkit-c-v4
esp32-devkit-c-v4