combined sourcode for mostly esp8266 sensor iot nodes.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

43 lines
876 B

#ifndef SENSOR_Anemometer_H
#define SENSOR_Anemometer_H
#include "sensordata.h"
#include <Homie.h>
class Sensor_Anemometer
{
private:
HomieNode *sensorNode; //reference to HomieNode
int pin;
struct sensordata data; //struct values are changed in setup()
//value in [m/s]
bool init_ok;
unsigned long anemometer_lasttimereset=0;
#define ANEMOMETER_DEBOUNCETIME 15 //15ms between pulses is approx 85m/s windspeed
public:
Sensor_Anemometer(int p);
void init();
void setSettings(float minchange, unsigned long senddelaymax, unsigned long readdelay);
void advertise(HomieNode& p_sensorNode);
void sensorloop();
//void ICACHE_RAM_ATTR interrupt_anemometer();
uint16_t anemometer_pulsecounter=0; //counted pulses since last reset
unsigned long anemometer_lastpulse_fordebounce=0;
};
#endif