Add force parameter to read methods

This allows forcing a read, even if the previous read was less than 2
seconds ago. This is useful in cases where the millis() timer is not
reliable, such as when sleeping. In this case, it is up to the caller to
ensure that at least 2 seconds elapse between calls with force set to
true.
This commit is contained in:
Matthijs Kooijman
2015-07-24 17:37:24 +02:00
parent 5cd78aead6
commit 04905bc5cd
2 changed files with 8 additions and 8 deletions

6
DHT.h
View File

@ -39,12 +39,12 @@ class DHT {
public:
DHT(uint8_t pin, uint8_t type, uint8_t count=6);
void begin(void);
float readTemperature(bool S=false);
float readTemperature(bool S=false, bool force=false);
float convertCtoF(float);
float convertFtoC(float);
float computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit=true);
float readHumidity(void);
boolean read(void);
float readHumidity(bool force=false);
boolean read(bool force=false);
private:
uint8_t data[6];