sensoresp/include/sensor_hcsr501.h

33 lines
514 B
C++

#ifndef SENSOR_HCSR501_H
#define SENSOR_HCSR501_H
#include "sensordata.h"
#include <Homie.h>
class Sensor_HCSR501
{
private:
HomieNode *sensorNode; //reference to HomieNode
int hcsr501pin;
struct sensordata data; //struct values are changed in setup()
bool init_ok;
public:
Sensor_HCSR501(int pin);
void init();
void setSettings(unsigned long senddelaymax, unsigned long readdelay);
void advertise(HomieNode& p_sensorNode);
void sensorloop();
};
#endif