Update example to show temp in Fahrenheit and add computeHeatIndex function to resolve issue #9.

This commit is contained in:
Tony DiCola
2014-06-02 12:54:54 -07:00
parent 633eb08654
commit ffac2f15b7
3 changed files with 28 additions and 1 deletions

14
DHT.cpp
View File

@ -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;