Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of DHT by
Revision 4:1e78a462b211, committed 2017-07-20
- Comitter:
- david8251
- Date:
- Thu Jul 20 09:04:07 2017 +0000
- Parent:
- 2:df22ddf10d75
- Child:
- 5:d69bf5f18bf8
- Commit message:
- DHT
Changed in this revision
| DHT.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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)
{
