mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
Merge pull request #112 from SConaway/patch-1
Read Temp and Humidity if not specified
This commit is contained in:
commit
bf86a4068c
10
DHT.cpp
10
DHT.cpp
@ -19,7 +19,7 @@ DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
|
||||
_maxcycles = microsecondsToClockCycles(1000); // 1 millisecond timeout for
|
||||
// reading pulses from DHT sensor.
|
||||
// Note that count is now ignored as the DHT reading algorithm adjusts itself
|
||||
// basd on the speed of the processor.
|
||||
// based on the speed of the processor.
|
||||
}
|
||||
|
||||
void DHT::begin(void) {
|
||||
@ -92,7 +92,13 @@ float DHT::readHumidity(bool force) {
|
||||
}
|
||||
|
||||
//boolean isFahrenheit: True == Fahrenheit; False == Celcius
|
||||
float DHT::computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit) {
|
||||
float DHT::computeHeatIndex(isFahrenheit) {
|
||||
float hi = self.computeHeatIndex(self.readTemperature(isFahrenheit), self.readHumidity(), isFahrenheit);
|
||||
return isFahrenheit ? hi : convertFtoC(hi);
|
||||
}
|
||||
|
||||
//boolean isFahrenheit: True == Fahrenheit; False == Celcius
|
||||
float DHT::computeHeatIndex(float temperature, floast percentHumidity, bool isFahrenheit) {
|
||||
// Using both Rothfusz and Steadman's equations
|
||||
// http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml
|
||||
float hi;
|
||||
|
1
DHT.h
1
DHT.h
@ -43,6 +43,7 @@ class DHT {
|
||||
float readTemperature(bool S=false, bool force=false);
|
||||
float convertCtoF(float);
|
||||
float convertFtoC(float);
|
||||
float computeHeatIndex(bool isFahrenheit=true);
|
||||
float computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit=true);
|
||||
float readHumidity(bool force=false);
|
||||
bool read(bool force=false);
|
||||
|
Loading…
Reference in New Issue
Block a user