Modified DHT11 Library with floated variable to allow readings in Centigrade
Fork of DHT11 by
Dht11.h@0:c1da310d3e8a, 2015-02-15 (annotated)
- Committer:
- fossum_13
- Date:
- Sun Feb 15 02:09:00 2015 +0000
- Revision:
- 0:c1da310d3e8a
- Child:
- 1:5da6f6de3e42
Initial version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fossum_13 | 0:c1da310d3e8a | 1 | #ifndef DHT11_H |
fossum_13 | 0:c1da310d3e8a | 2 | #define DHT11_H |
fossum_13 | 0:c1da310d3e8a | 3 | |
fossum_13 | 0:c1da310d3e8a | 4 | #include "mbed.h" |
fossum_13 | 0:c1da310d3e8a | 5 | |
fossum_13 | 0:c1da310d3e8a | 6 | #define DHTLIB_OK 0 |
fossum_13 | 0:c1da310d3e8a | 7 | #define DHTLIB_ERROR_CHECKSUM -1 |
fossum_13 | 0:c1da310d3e8a | 8 | #define DHTLIB_ERROR_TIMEOUT -2 |
fossum_13 | 0:c1da310d3e8a | 9 | |
fossum_13 | 0:c1da310d3e8a | 10 | class Dht11 { |
fossum_13 | 0:c1da310d3e8a | 11 | public: |
fossum_13 | 0:c1da310d3e8a | 12 | Dht11(PinName p); |
fossum_13 | 0:c1da310d3e8a | 13 | int read(); |
fossum_13 | 0:c1da310d3e8a | 14 | int temperature(); |
fossum_13 | 0:c1da310d3e8a | 15 | int humidity(); |
fossum_13 | 0:c1da310d3e8a | 16 | |
fossum_13 | 0:c1da310d3e8a | 17 | private: |
fossum_13 | 0:c1da310d3e8a | 18 | int _humidity; |
fossum_13 | 0:c1da310d3e8a | 19 | int _temperature; |
fossum_13 | 0:c1da310d3e8a | 20 | DigitalInOut _pin; |
fossum_13 | 0:c1da310d3e8a | 21 | Timer _timer; |
fossum_13 | 0:c1da310d3e8a | 22 | }; |
fossum_13 | 0:c1da310d3e8a | 23 | |
fossum_13 | 0:c1da310d3e8a | 24 | #endif |