Skip to content

Commit 7f7425f

Browse files
committed
Resolve #24 by adding convert F to C function.
1 parent f2a48d6 commit 7f7425f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

DHT.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ float DHT::convertCtoF(float c) {
5353
return c * 9 / 5 + 32;
5454
}
5555

56+
float DHT::convertFtoC(float f) {
57+
return (f - 32) * 5 / 9;
58+
}
59+
5660
float DHT::readHumidity(void) {
5761
float f;
5862
if (read()) {

DHT.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class DHT {
3232
void begin(void);
3333
float readTemperature(bool S=false);
3434
float convertCtoF(float);
35+
float convertFtoC(float);
3536
float computeHeatIndex(float tempFahrenheit, float percentHumidity);
3637
float readHumidity(void);
3738
boolean read(void);

0 commit comments

Comments
 (0)