Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By davestoweuk
#42401 I was having nightmares trying to get a DHT22 to read continuously to post to MQTT. It would only read the sensor one then stop! :evil:
If I took out the library ESP8266WiFi..h it would work!! :mrgreen: On testing my program, and getting the adafruit library into debug mode I saw I was getting 'Timeout waiting for start signal low pulse' errors. :?:
Looking into the code in the file DHT.cpp I found this bit :

// Now start reading the data line to get the value from the DHT sensor.
pinMode(_pin, INPUT_PULLUP);
delayMicroseconds(10); // Delay a bit to let sensor pull data line low.

I kept increasing this value in steps of 5 Microseconds until I got continuous readings. I increased it from 10 and now use a value of 40.
It has now been running for 34 hours and no errors!!! :D

Hope this helps someone! Its working perfect for me!
Can someone explain why? The datasheets expect everyone to be an expert in this field. :ugeek: :ugeek:
I believe in 'try it and see' :D :lol:
I added my test code for those who are willing to have a look.
You do not have the required permissions to view the files attached to this post.