2011-12-03 07:50:02 +04:00
|
|
|
#if ARDUINO >= 100
|
|
|
|
#include "Arduino.h"
|
|
|
|
#else
|
|
|
|
#include "WProgram.h"
|
|
|
|
#endif
|
2011-06-22 21:11:06 +04:00
|
|
|
|
2011-06-21 03:47:50 +04:00
|
|
|
/* DHT library
|
|
|
|
|
|
|
|
MIT license
|
|
|
|
written by Adafruit Industries
|
|
|
|
*/
|
2011-06-22 21:11:06 +04:00
|
|
|
|
|
|
|
// 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);
|
2012-02-23 23:43:30 +04:00
|
|
|
float readTemperature(bool S=false);
|
2012-02-23 07:20:19 +04:00
|
|
|
float convertCtoF(float);
|
2011-06-22 21:11:06 +04:00
|
|
|
float readHumidity(void);
|
|
|
|
|
|
|
|
};
|