DHT1

Dependents:   greenhouse_proj SmartCampus_DHT OLED_graph_Hongli

Fork of DHT by jajn HA

Files at this revision

API Documentation at this revision

Comitter:
david8251
Date:
Thu Jul 20 09:04:07 2017 +0000
Parent:
2:df22ddf10d75
Commit message:
DHT

Changed in this revision

DHT.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r df22ddf10d75 -r 1e78a462b211 DHT.cpp
--- a/DHT.cpp	Fri Aug 15 20:55:43 2014 +0000
+++ b/DHT.cpp	Thu Jul 20 09:04:07 2017 +0000
@@ -78,7 +78,7 @@
     DHT_io.output();
     DHT_io = 0;
     // only 500uS for DHT22 but 18ms for DHT11
-    (_DHTtype == 11) ? wait_ms(18) : wait(1);
+    (_DHTtype == 11) ? wait_ms(18) : wait(0.0005);
     DHT_io = 1;
     wait_us(30);
     DHT_io.input();
@@ -156,7 +156,7 @@
 
 float DHT::ReadHumidity()
 {
-    return _lastHumidity;
+    return _lastHumidity+30;
 }
 
 float DHT::ConvertCelciustoFarenheit(float const celsius)
@@ -179,7 +179,7 @@
     SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
     SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
     SUM += log10(1013.246);
-    float VP = pow(10, SUM-3) * humidity;
+    float VP = pow(10, SUM-3) * (humidity);
     float T = log(VP/0.61078);   // temp var
     return (241.88 * T) / (17.558-T);
 }
@@ -187,14 +187,14 @@
 // delta max = 0.6544 wrt dewPoint()
 // 5x faster than dewPoint()
 // reference: http://en.wikipedia.org/wiki/Dew_point
-float DHT::CalcdewPointFast(float const celsius, float const humidity)
+/*float DHT::CalcdewPointFast(float const celsius, float const humidity)
 {
     float a = 17.271;
     float b = 237.7;
     float temp = (a * celsius) / (b + celsius) + log(humidity/100);
     float Td = (b * temp) / (a - temp);
     return Td;
-}
+}*/
 
 float DHT::ReadTemperature(eScale Scale)
 {