Skip to content

Commit 71ee113

Browse files
committed
Merge pull request #4 from Jearil/master
Adding #ifndef DHT_H to header file
2 parents 53e6481 + fca7132 commit 71ee113

File tree

1 file changed

+39
-36
lines changed

1 file changed

+39
-36
lines changed

DHT.h

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
1-
#if ARDUINO >= 100
2-
#include "Arduino.h"
3-
#else
4-
#include "WProgram.h"
5-
#endif
6-
7-
/* DHT library
8-
9-
MIT license
10-
written by Adafruit Industries
11-
*/
12-
13-
// how many timing transitions we need to keep track of. 2 * number bits + extra
14-
#define MAXTIMINGS 85
15-
16-
#define DHT11 11
17-
#define DHT22 22
18-
#define DHT21 21
19-
#define AM2301 21
20-
21-
class DHT {
22-
private:
23-
uint8_t data[6];
24-
uint8_t _pin, _type;
25-
boolean read(void);
26-
unsigned long _lastreadtime;
27-
boolean firstreading;
28-
29-
public:
30-
DHT(uint8_t pin, uint8_t type);
31-
void begin(void);
32-
float readTemperature(bool S=false);
33-
float convertCtoF(float);
34-
float readHumidity(void);
35-
36-
};
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+
9+
/* DHT library
10+
11+
MIT license
12+
written by Adafruit Industries
13+
*/
14+
15+
// how many timing transitions we need to keep track of. 2 * number bits + extra
16+
#define MAXTIMINGS 85
17+
18+
#define DHT11 11
19+
#define DHT22 22
20+
#define DHT21 21
21+
#define AM2301 21
22+
23+
class DHT {
24+
private:
25+
uint8_t data[6];
26+
uint8_t _pin, _type;
27+
boolean read(void);
28+
unsigned long _lastreadtime;
29+
boolean firstreading;
30+
31+
public:
32+
DHT(uint8_t pin, uint8_t type);
33+
void begin(void);
34+
float readTemperature(bool S=false);
35+
float convertCtoF(float);
36+
float readHumidity(void);
37+
38+
};
39+
#endif

0 commit comments

Comments
 (0)