37 lines
648 B
C++
37 lines
648 B
C++
#ifndef SENSOR_ML8511_H
|
|
#define SENSOR_ML8511_H
|
|
|
|
#include "sensordata.h"
|
|
#include <Homie.h>
|
|
|
|
|
|
|
|
class Sensor_ML8511
|
|
{
|
|
|
|
private:
|
|
HomieNode *sensorNode; //reference to HomieNode
|
|
|
|
int ml8511pin;
|
|
|
|
struct sensordata data; //struct values are changed in setup()
|
|
|
|
bool init_ok;
|
|
|
|
float getUV_ML8511(int pin);
|
|
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max);
|
|
|
|
public:
|
|
Sensor_ML8511(int pin);
|
|
|
|
|
|
void init();
|
|
void setSettings(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
|
void advertise(HomieNode& p_sensorNode);
|
|
void sensorloop();
|
|
|
|
};
|
|
|
|
#endif
|
|
|