DHT.h 707 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef __DHT_H__
  2. #define __DHT_H__
  3. #if ARDUINO >= 100
  4. #include "Arduino.h"
  5. #else
  6. #include "WProgram.h"
  7. #endif
  8. /* DHT library
  9. MIT license
  10. written by Adafruit Industries
  11. */
  12. // how many timing transitions we need to keep track of. 2 * number bits + extra
  13. #define MAXTIMINGS 85
  14. #define DHT11 11
  15. #define DHT22 22
  16. #define DHT21 21
  17. #define AM2301 21
  18. class DHT
  19. {
  20. private:
  21. uint8_t data[6];
  22. uint8_t _pin, _type, _count;
  23. boolean read(void);
  24. unsigned long _lastreadtime;
  25. boolean firstreading;
  26. public:
  27. DHT(uint8_t pin, uint8_t type, uint8_t count=6);
  28. void begin(void);
  29. float readTemperature(bool S=false);
  30. float convertCtoF(float);
  31. float readHumidity(void);
  32. };
  33. #endif