Simple library for the DHT11 temperature and humidity sensor. Forked from an existing Mbed DHT11 project.

Dependents:   UoY-DHT11-test

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.

History

Interface changes to remove the need for separate readData() calls default tip

2021-09-15, by ajp109 [Wed, 15 Sep 2021 14:47:06 +0000] rev 13

Interface changes to remove the need for separate readData() calls


Update to MbedOS6+

2021-05-31, by JohnnyK [Mon, 31 May 2021 07:02:00 +0000] rev 12

Update to MbedOS6+


Bug fix (I/O pin is changed to OUTPUT for the start pulse).

2014-09-25, by s_inoue_mbed [Thu, 25 Sep 2014 14:13:10 +0000] rev 11

Bug fix (I/O pin is changed to OUTPUT for the start pulse).


License has been changed from Apache2 to MIT lisence.

2014-09-16, by s_inoue_mbed [Tue, 16 Sep 2014 13:06:43 +0000] rev 10

License has been changed from Apache2 to MIT lisence.


Bug fix

2014-09-11, by s_inoue_mbed [Thu, 11 Sep 2014 13:45:00 +0000] rev 9

Bug fix


Pulse widths have been changed.

2014-09-10, by s_inoue_mbed [Wed, 10 Sep 2014 18:00:31 +0000] rev 8

Pulse widths have been changed.


readData() has been simplified.

2014-09-10, by s_inoue_mbed [Wed, 10 Sep 2014 17:48:35 +0000] rev 7

readData() has been simplified.


Reorganized initialization function

2014-09-10, by s_inoue_mbed [Wed, 10 Sep 2014 17:43:14 +0000] rev 6

Reorganized initialization function


Doxygen documentation has been corrected.

2014-09-10, by s_inoue_mbed [Wed, 10 Sep 2014 17:35:27 +0000] rev 5

Doxygen documentation has been corrected.


Doxygen documentation has been corrected.

2014-09-10, by s_inoue_mbed [Wed, 10 Sep 2014 17:18:28 +0000] rev 4

Doxygen documentation has been corrected.