mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
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.
This commit is contained in:
parent
53e6481231
commit
fca71323bd
75
DHT.h
75
DHT.h
@ -1,36 +1,39 @@
|
|||||||
#if ARDUINO >= 100
|
#ifndef DHT_H
|
||||||
#include "Arduino.h"
|
#define DHT_H
|
||||||
#else
|
#if ARDUINO >= 100
|
||||||
#include "WProgram.h"
|
#include "Arduino.h"
|
||||||
#endif
|
#else
|
||||||
|
#include "WProgram.h"
|
||||||
/* DHT library
|
#endif
|
||||||
|
|
||||||
MIT license
|
/* DHT library
|
||||||
written by Adafruit Industries
|
|
||||||
*/
|
MIT license
|
||||||
|
written by Adafruit Industries
|
||||||
// how many timing transitions we need to keep track of. 2 * number bits + extra
|
*/
|
||||||
#define MAXTIMINGS 85
|
|
||||||
|
// how many timing transitions we need to keep track of. 2 * number bits + extra
|
||||||
#define DHT11 11
|
#define MAXTIMINGS 85
|
||||||
#define DHT22 22
|
|
||||||
#define DHT21 21
|
#define DHT11 11
|
||||||
#define AM2301 21
|
#define DHT22 22
|
||||||
|
#define DHT21 21
|
||||||
class DHT {
|
#define AM2301 21
|
||||||
private:
|
|
||||||
uint8_t data[6];
|
class DHT {
|
||||||
uint8_t _pin, _type;
|
private:
|
||||||
boolean read(void);
|
uint8_t data[6];
|
||||||
unsigned long _lastreadtime;
|
uint8_t _pin, _type;
|
||||||
boolean firstreading;
|
boolean read(void);
|
||||||
|
unsigned long _lastreadtime;
|
||||||
public:
|
boolean firstreading;
|
||||||
DHT(uint8_t pin, uint8_t type);
|
|
||||||
void begin(void);
|
public:
|
||||||
float readTemperature(bool S=false);
|
DHT(uint8_t pin, uint8_t type);
|
||||||
float convertCtoF(float);
|
void begin(void);
|
||||||
float readHumidity(void);
|
float readTemperature(bool S=false);
|
||||||
|
float convertCtoF(float);
|
||||||
};
|
float readHumidity(void);
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user