Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added constructor parameter to allow for different timing needs. It has the a default value of 6 which is the original value, so it should be backwards compatible
- Loading branch information
Showing
2 changed files
with
5 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,10 @@ written by Adafruit Industries | |
|
||
#include "DHT.h" | ||
|
||
DHT::DHT(uint8_t pin, uint8_t type) { | ||
DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) { | ||
_pin = pin; | ||
_type = type; | ||
_count = count; | ||
firstreading = true; | ||
} | ||
|
||
|
@@ -129,7 +130,7 @@ boolean DHT::read(void) { | |
if ((i >= 4) && (i%2 == 0)) { | ||
// shove each bit into the storage bytes | ||
data[j/8] <<= 1; | ||
if (counter > 6) | ||
if (counter > _count) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
soerup
Author
Contributor
|
||
data[j/8] |= 1; | ||
j++; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
how is this to be used, e.g. for an 8mhz atmega328p? do we halve or double count perhaps?