40 lines
847 B
C++
40 lines
847 B
C++
#ifndef SENSOR_HTU21D_H
|
|
#define SENSOR_HTU21D_H
|
|
|
|
#include "sensordata.h"
|
|
#include <Homie.h>
|
|
|
|
#include <Wire.h>
|
|
#include <Adafruit_HTU21DF.h>
|
|
|
|
|
|
class Sensor_HTU21D
|
|
{
|
|
|
|
private:
|
|
|
|
Adafruit_HTU21DF *htu;
|
|
HomieNode *sensorNode; //reference to HomieNode
|
|
|
|
struct sensordata data_temperature; //struct values are changed in setup()
|
|
struct sensordata data_humidity; //struct values are changed in setup()
|
|
|
|
bool init_ok;
|
|
|
|
public:
|
|
Sensor_HTU21D();
|
|
|
|
void loop_HTU21D_temperature();
|
|
void loop_HTU21D_humidity();
|
|
|
|
void init();
|
|
void setSettings_Temperature(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
|
void setSettings_Humidity(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
|
void advertise(HomieNode& p_sensorNode);
|
|
void sensorloop();
|
|
|
|
};
|
|
|
|
#endif
|
|
|