....
Dependents: WizFi310_ThingPlug_Test WizFi310_ThingPlug_Test_P WizFi310_Sensor_Test
Fork of DHT11 by
Diff: Dht11.cpp
- Revision:
- 1:5da6f6de3e42
- Parent:
- 0:c1da310d3e8a
--- a/Dht11.cpp Sun Feb 15 02:09:00 2015 +0000
+++ b/Dht11.cpp Mon Feb 16 01:43:08 2015 +0000
@@ -1,16 +1,15 @@
#include "Dht11.h"
-Dht11::Dht11(PinName p) : _pin(p) {
+Dht11::Dht11(PinName const &p) : _pin(p) {
// Set creation time so we can make
// sure we pause at least 1 second for
// startup.
_timer.start();
+
+ _temperature = 0;
+ _humidity = 0;
}
-// Return values:
-// DHTLIB_OK
-// DHTLIB_ERROR_CHECKSUM
-// DHTLIB_ERROR_TIMEOUT
int Dht11::read()
{
// BUFFER TO RECEIVE
@@ -77,10 +76,14 @@
return DHTLIB_OK;
}
-int Dht11::temperature() {
+float Dht11::getFahrenheit() {
+ return((_temperature * 1.8) + 32);
+}
+
+int Dht11::getCelsius() {
return(_temperature);
}
-int Dht11::humidity() {
+int Dht11::getHumidity() {
return(_humidity);
}
