mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
fully tested working DHT11/21/22 with built in '2 second' timer
This commit is contained in:
27
DHT.h
27
DHT.h
@ -1,5 +1,32 @@
|
||||
|
||||
#include <WProgram.h>
|
||||
|
||||
/* DHT library
|
||||
|
||||
MIT license
|
||||
written by Adafruit Industries
|
||||
*/
|
||||
|
||||
// how many timing transitions we need to keep track of. 2 * number bits + extra
|
||||
#define MAXTIMINGS 85
|
||||
|
||||
#define DHT11 11
|
||||
#define DHT22 22
|
||||
#define DHT21 21
|
||||
#define AM2301 21
|
||||
|
||||
class DHT {
|
||||
private:
|
||||
uint8_t data[6];
|
||||
uint8_t _pin, _type;
|
||||
boolean read(void);
|
||||
unsigned long _lastreadtime;
|
||||
boolean firstreading;
|
||||
|
||||
public:
|
||||
DHT(uint8_t pin, uint8_t type);
|
||||
void begin(void);
|
||||
float readTemperature(void);
|
||||
float readHumidity(void);
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user