A minimal library for the DHT11.
Dependents: EXP10_DHT11_LCD Sushil_MODSERIAL Core1000_SmartFarm idd_summer17_hw3_evey_jenny_seiyoung ... more
Diff: Dht11.h
- Revision:
- 0:c1da310d3e8a
- Child:
- 1:5da6f6de3e42
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Dht11.h Sun Feb 15 02:09:00 2015 +0000 @@ -0,0 +1,24 @@ +#ifndef DHT11_H +#define DHT11_H + +#include "mbed.h" + +#define DHTLIB_OK 0 +#define DHTLIB_ERROR_CHECKSUM -1 +#define DHTLIB_ERROR_TIMEOUT -2 + +class Dht11 { +public: + Dht11(PinName p); + int read(); + int temperature(); + int humidity(); + +private: + int _humidity; + int _temperature; + DigitalInOut _pin; + Timer _timer; +}; + +#endif