Adafruit TinyDHT Sensor Library
TinyDHT.h
Go to the documentation of this file.
1 
4 #ifndef DHT_H
5 #define DHT_H
6 #if ARDUINO >= 100
7 #include "Arduino.h"
8 #else
9 #include "WProgram.h"
10 #endif
11 
12 /* Tiny DHT library
13 Uses integer math to save space on Trinket/Gemma
14 
15 MIT license
16 written by Adafruit Industries
17 */
18 
19 #define MAXTIMINGS \
20  85
21 
23 #define DHT11 11
24 #define DHT22 22
25 #define DHT21 21
26 #define AM2301 21
27 
28 // NAN code in DHT library takes space, define bad values here
29 #define BAD_HUM -1
30 #define BAD_TEMP -999
31 
32 
35 class DHT {
36 private:
37  uint8_t data[6];
38  uint8_t _pin, _type, _count;
39  boolean read(void);
40  unsigned long _lastreadtime;
41  boolean firstreading;
42 
43 public:
51  DHT(uint8_t pin, uint8_t type, uint8_t count = 6);
55  void begin(void);
61  int16_t readTemperature(bool S = false);
67  int16_t convertCtoF(int16_t);
72  uint8_t readHumidity(void);
73 };
74 #endif
int16_t convertCtoF(int16_t)
Converts Celcius to Fahrenheit.
Definition: TinyDHT.cpp:66
uint8_t readHumidity(void)
Reads the humidity from the device.
Definition: TinyDHT.cpp:68
DHT(uint8_t pin, uint8_t type, uint8_t count=6)
DHT constructor.
Definition: TinyDHT.cpp:22
void begin(void)
Begins connection with device.
Definition: TinyDHT.cpp:29
Class that stores the state and functions for the DHT.
Definition: TinyDHT.h:35
int16_t readTemperature(bool S=false)
Reads the temperature from device.
Definition: TinyDHT.cpp:37