Skip to content

Updating refresh rate #230

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions DHT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
(void)count; // Workaround to avoid compiler warning.
_pin = pin;
_type = type;
// Adjust MIN_INTERVAL based on sensor type
if (_type == DHT11) {
_minInterval = 1000; // 1 second for DHT11
} else {
_minInterval = 2000; // 2 seconds for other types
}
#ifdef __AVR
_bit = digitalPinToBitMask(pin);
_port = digitalPinToPort(pin);
Expand Down
1 change: 1 addition & 0 deletions DHT.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class DHT {
private:
uint8_t data[5];
uint8_t _pin, _type;
uint32_t _minInterval; // Minimum interval between reads
#ifdef __AVR
// Use direct GPIO access on an 8-bit AVR so keep track of the port and
// bitmask for the digital pin connected to the DHT. Other platforms will use
Expand Down
Loading