Resolve #24 by adding convert F to C function.

This commit is contained in:
Tony DiCola 2014-07-25 19:34:35 -07:00
parent f2a48d6267
commit 7f7425f11e
2 changed files with 5 additions and 0 deletions

View File

@ -53,6 +53,10 @@ float DHT::convertCtoF(float c) {
return c * 9 / 5 + 32; return c * 9 / 5 + 32;
} }
float DHT::convertFtoC(float f) {
return (f - 32) * 5 / 9;
}
float DHT::readHumidity(void) { float DHT::readHumidity(void) {
float f; float f;
if (read()) { if (read()) {

1
DHT.h
View File

@ -32,6 +32,7 @@ class DHT {
void begin(void); void begin(void);
float readTemperature(bool S=false); float readTemperature(bool S=false);
float convertCtoF(float); float convertCtoF(float);
float convertFtoC(float);
float computeHeatIndex(float tempFahrenheit, float percentHumidity); float computeHeatIndex(float tempFahrenheit, float percentHumidity);
float readHumidity(void); float readHumidity(void);
boolean read(void); boolean read(void);