DHT22 microPython on ESP8266
import dht
from time import sleep
import machine
d = dht.DHT22(machine.Pin(14))
while True:
d.measure()
print('T={} H={}'.format(d.temperature(),d.humidity())) # eg. 23.6 (°C)
sleep(2)
import dht
from time import sleep
import machine
d = dht.DHT22(machine.Pin(14))
while True:
d.measure()
print('T={} H={}'.format(d.temperature(),d.humidity())) # eg. 23.6 (°C)
sleep(2)
Comments