DHT11 & 22 question

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
warren
Posts: 74
Joined: Tue Jul 12, 2016 5:47 pm

DHT11 & 22 question

Post by warren » Fri Jul 15, 2016 2:32 pm

Hi

Almost certainly this will strike some here as a tedious newbie question - sorry...

I have a nicely working ESP8266 with Micropython - I got past all the teething troubles with poor power supplies, unreliable flashing sessions, general python learning curve etc..

But this has me stumped. I found the DHT class library for the ESP8266:

https://github.com/micropython/micropyt ... pts/dht.py

How do I use this in my script?

Suggestion: when you publish libraries for micropython, please include even a few lines as an "Idiot's guide to using this...'

I say that because micropython is but one of several ESP8266 possible environments, and as such is 'competing' with more mature / documented / supported things. It would be a shame to lose potential adopters for want of a few more simple signposts along the way...

But again, "thank you" to all those who are making micropython on the ESP a reality. It truly rocks! I really hope it is widely adopted for IoT applications...

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: DHT11 & 22 question

Post by Roberthh » Fri Jul 15, 2016 2:53 pm

Result from short search in this forum:

Code: Select all

import dht
import machine, time
d = dht.DHT22(machine.Pin(4))
while True:
  d.measure()
  d.temperature(), d.humidity()
  time.sleep(1)

warren
Posts: 74
Joined: Tue Jul 12, 2016 5:47 pm

Re: DHT11 & 22 question

Post by warren » Fri Jul 15, 2016 3:12 pm

Thank you.

Post Reply