Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (31 sloc) 0.644 kb
d32203d @drbrain Wireless Arduino temperature sensor
authored
1 #ifndef _DHT22_H_
2 #define _DHT22_H_
3
4 #include <inttypes.h>
5
6 #define DHT22_ERROR_VALUE -99.5
7
8 typedef enum
9 {
10 DHT_ERROR_NONE = 0,
11 DHT_BUS_HUNG,
12 DHT_ERROR_NOT_PRESENT,
13 DHT_ERROR_ACK_TOO_LONG,
14 DHT_ERROR_SYNC_TIMEOUT,
15 DHT_ERROR_DATA_TIMEOUT,
16 DHT_ERROR_CHECKSUM,
17 DHT_ERROR_TOOQUICK
18 } DHT22_ERROR_t;
19
20 class DHT22
21 {
22 private:
23 uint8_t _bitmask;
24 volatile uint8_t *_baseReg;
25 unsigned long _lastReadTime;
26 double _lastHumidity;
27 double _lastTemperature;
28
29 public:
30 DHT22(uint8_t pin);
31 DHT22_ERROR_t readData(void);
32 int getHumidity();
33 int getTemperatureC();
34 void clockReset();
35 };
36
37 #endif /*_DHT22_H_*/
Something went wrong with that request. Please try again.