From 4c6444650da3a0aa1e2e9b00f42cc4e2af057fe6 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 18 Jun 2014 11:48:46 +0200 Subject: initial commit Signed-off-by: Florian Pritz --- lib/DHT_sensor_library/DHT.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/DHT_sensor_library/DHT.h (limited to 'lib/DHT_sensor_library/DHT.h') diff --git a/lib/DHT_sensor_library/DHT.h b/lib/DHT_sensor_library/DHT.h new file mode 100644 index 0000000..1c78c87 --- /dev/null +++ b/lib/DHT_sensor_library/DHT.h @@ -0,0 +1,39 @@ +#ifndef DHT_H +#define DHT_H +#if ARDUINO >= 100 + #include "Arduino.h" +#else + #include "WProgram.h" +#endif + +/* 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, _count; + boolean read(void); + unsigned long _lastreadtime; + boolean firstreading; + + public: + DHT(uint8_t pin, uint8_t type, uint8_t count=6); + void begin(void); + float readTemperature(bool S=false); + float convertCtoF(float); + float readHumidity(void); + +}; +#endif -- cgit v1.2.3-24-g4f1b