Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Still playing with micropython and the DHT11
import dht
import machine
from machine import Timer
d = dht.DHT11(machine.Pin(4))
def display_dht11(t):
d.measure()
print('Temperature:', d.temperature(), 'Humidity:', d.humidity())
tim = Timer(-1)
tim.init(period=5000, mode=Timer.PERIODIC, callback=display_dht11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment