Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First read always fails #14

Open
msandres13 opened this issue Sep 12, 2018 · 0 comments
Open

First read always fails #14

msandres13 opened this issue Sep 12, 2018 · 0 comments

Comments

@msandres13
Copy link

Testing several iteration always the first read fails.
After some google search I found https://github.com/winlinvip/SimpleDHT which has a well documented sequence reading the temp data.
I adapted the init sequence to the same way SimpleDHT does.
After that the read always works on the first attempt.
Snippet from dht22.c
pinMode(DHTPIN, OUTPUT);
//digitalWrite(DHTPIN, HIGH);
//delay(10);
digitalWrite(DHTPIN, LOW);
delay(20);
// then pull it up for 20-40 microseconds
digitalWrite(DHTPIN, HIGH);
delayMicroseconds(25);
// prepare to read the pin
pinMode(DHTPIN, INPUT);
----<>---
If not called frequent it works with my setup everytime.
Attached dht22.c as txt since github wont allow .c
dht22.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant