Skip to content

Removed "End the start signal by setting data line high for 40 micros… #51

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

Closed
wants to merge 1 commit into from

Conversation

krzychb
Copy link

@krzychb krzychb commented Dec 20, 2015

…econds"

Reference: #48 (comment)

@w-h many thanks for this fix!

@joseluis joseluis mentioned this pull request Aug 28, 2016
// therefore the low-high transition after the start signal "low" needs to be realised by
// the pullup resistor only, uC pin must already be in INPUT mode.
// ref: https://github.com/adafruit/DHT-sensor-library/issues/48#issue-119801608

// 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.
Copy link

@vlad-sh vlad-sh Sep 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found out there are must be some "smart" delay instead delayMicroseconds(10):

pinMode(_pin, INPUT_PULLUP); delayMicroseconds(10); // Delay a bit to let sensor pull data line low.

The delay may be like:

if (expectPulse(HIGH) == 0) { DEBUG_PRINTLN(F("Timeout waiting for start signal high pulse.")); _lastresult = false; return _lastresult; }

If no delay, next expectPulse(LOW) function often returns 0, because _pin is still HIGH (sensor takes from 20 to 200 microseconds to pull-down line to LOW, according datasheet).

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

Successfully merging this pull request may close these issues.

3 participants