Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Prevent dht.h being imported multiple times

Added a basic #ifndef DHT_H to the dht.h file so that if you have a
larger program and want to access the sensor from a different file, you
don't import it twice.
  • Loading branch information...
commit fca71323bd16d3d83bcf632e75410a6aae21cee6 1 parent 53e6481
@Jearil Jearil authored
Showing with 39 additions and 36 deletions.
  1. +39 −36 DHT.h
View
75 DHT.h
@@ -1,36 +1,39 @@
-#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;
- boolean read(void);
- unsigned long _lastreadtime;
- boolean firstreading;
-
- public:
- DHT(uint8_t pin, uint8_t type);
- void begin(void);
- float readTemperature(bool S=false);
- float convertCtoF(float);
- float readHumidity(void);
-
-};
+#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;
+ boolean read(void);
+ unsigned long _lastreadtime;
+ boolean firstreading;
+
+ public:
+ DHT(uint8_t pin, uint8_t type);
+ void begin(void);
+ float readTemperature(bool S=false);
+ float convertCtoF(float);
+ float readHumidity(void);
+
+};
+#endif
Please sign in to comment.
Something went wrong with that request. Please try again.