Simple library for the DHT11 temperature and humidity sensor. Forked from an existing Mbed DHT11 project.
Simple DHT11 temperature and humidity library.
Example usage
#include "mbed.h" #include "DHT11.h" DHT11 dht(D8); // Change pin name here if required main() { printf("T:%d, H:%d\r\n", dht.readTemperature(), dht.readHumidity()); }
The sensor may be read as often as desired, but temperature and humidity values are cached and will only be updated if they are more than 2 seconds old. This is the underlying sensor update rate.
Please note that this project has been modified only enough to make it work for its intended purpose. Various parts of this project still need work, and the source code should not be seen as an example of best practice.
Diff: DHT11.h
- Revision:
- 12:af1eadec17e5
- Parent:
- 10:f0d789f49df7
- Child:
- 13:11d0770eb603
diff -r e91c151d1798 -r af1eadec17e5 DHT11.h --- a/DHT11.h Thu Sep 25 14:13:10 2014 +0000 +++ b/DHT11.h Mon May 31 07:02:00 2021 +0000 @@ -25,7 +25,7 @@ * #include "mbed.h" * #include "DHT11.h" * - * DHT11 d; + * DHT11 d(D8); // Here fill your PIN mask/name * * main() * {