From 7f7425f11ee1365bee56b3f50f7effb9220fd3d7 Mon Sep 17 00:00:00 2001 From: Tony DiCola Date: Fri, 25 Jul 2014 19:34:35 -0700 Subject: [PATCH] Resolve #24 by adding convert F to C function. --- DHT.cpp | 4 ++++ DHT.h | 1 + 2 files changed, 5 insertions(+) diff --git a/DHT.cpp b/DHT.cpp index fe55016..2ef244c 100644 --- a/DHT.cpp +++ b/DHT.cpp @@ -53,6 +53,10 @@ float DHT::convertCtoF(float c) { return c * 9 / 5 + 32; } +float DHT::convertFtoC(float f) { + return (f - 32) * 5 / 9; +} + float DHT::readHumidity(void) { float f; if (read()) { diff --git a/DHT.h b/DHT.h index 8f40a02..5280f9c 100644 --- a/DHT.h +++ b/DHT.h @@ -32,6 +32,7 @@ class DHT { void begin(void); float readTemperature(bool S=false); float convertCtoF(float); + float convertFtoC(float); float computeHeatIndex(float tempFahrenheit, float percentHumidity); float readHumidity(void); boolean read(void);