mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
Update example to show temp in Fahrenheit and add computeHeatIndex function to resolve issue #9.
This commit is contained in:
14
DHT.cpp
14
DHT.cpp
@ -74,6 +74,20 @@ float DHT::readHumidity(void) {
|
||||
return NAN;
|
||||
}
|
||||
|
||||
float DHT::computeHeatIndex(float tempFahrenheit, float percentHumidity) {
|
||||
// Adapted from equation at: https://github.com/adafruit/DHT-sensor-library/issues/9 and
|
||||
// Wikipedia: http://en.wikipedia.org/wiki/Heat_index
|
||||
return -42.379 +
|
||||
2.04901523 * tempFahrenheit +
|
||||
10.14333127 * percentHumidity +
|
||||
-0.22475541 * tempFahrenheit*percentHumidity +
|
||||
-0.00683783 * pow(tempFahrenheit, 2) +
|
||||
-0.05481717 * pow(percentHumidity, 2) +
|
||||
0.00122874 * pow(tempFahrenheit, 2) * percentHumidity +
|
||||
0.00085282 * tempFahrenheit*pow(percentHumidity, 2) +
|
||||
-0.00000199 * pow(tempFahrenheit, 2) * pow(percentHumidity, 2);
|
||||
}
|
||||
|
||||
|
||||
boolean DHT::read(void) {
|
||||
uint8_t laststate = HIGH;
|
||||
|
Reference in New Issue
Block a user