Skip to content

Instantly share code, notes, and snippets.

@guillemborrell
Created November 10, 2016 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guillemborrell/460aba462267bcc9bf0a03f330af8efd to your computer and use it in GitHub Desktop.
Save guillemborrell/460aba462267bcc9bf0a03f330af8efd to your computer and use it in GitHub Desktop.
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