mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
Resolve #24 by adding convert F to C function.
This commit is contained in:
parent
f2a48d6267
commit
7f7425f11e
4
DHT.cpp
4
DHT.cpp
@ -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
1
DHT.h
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user