GY-63_MS5611/libraries/DHT12/DHT12.h

48 lines
940 B
C
Raw Normal View History

2020-11-27 05:10:47 -05:00
#pragma once
//
// FILE: DHT12.h
// AUTHOR: Rob Tillaart
// PURPOSE: DHT_I2C library for Arduino .
2020-11-27 05:10:47 -05:00
// VERSION: 0.2.1
// HISTORY: See DHT12.cpp
2020-11-27 05:10:47 -05:00
// URL: https://github.com/RobTillaart/DHT12
//
2020-11-27 05:10:47 -05:00
#include <Wire.h>
2020-11-27 05:10:47 -05:00
#define DHT12_LIB_VERSION "0.2.1"
#define DHT12_OK 0
#define DHT12_ERROR_CHECKSUM -10
#define DHT12_ERROR_CONNECT -11
#define DHT12_MISSING_BYTES -12
class DHT12
{
public:
2020-11-27 05:10:47 -05:00
explicit DHT12();
explicit DHT12(TwoWire *wire); // to be tested explicitly
2020-11-27 05:10:47 -05:00
#if defined(ESP8266) || defined(ESP32)
void begin(const uint8_t dataPin, const uint8_t clockPin);
#endif
void begin();
int8_t read();
2020-11-27 05:10:47 -05:00
// preferred interface
float getHumidity() { return humidity; };
float getTemperature() { return temperature; };
// members will become private in the future.
float humidity;
float temperature;
private:
uint8_t bits[5];
int _readSensor();
2020-11-27 05:10:47 -05:00
TwoWire* _wire;
};
2020-11-27 05:10:47 -05:00
// -- END OF FILE --