Skip to content

First read always fails #14

@msandres13

Description

@msandres13

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions