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.

42 lines
1.1 KiB

#ifndef SENSOR_HS1101_H
#define SENSOR_HS1101_H
#include "sensordata.h"
#include <Homie.h>
class Sensor_HS1101
HomieNode *sensorNode; //reference to HomieNode
struct sensordata data; //struct values are changed in setup()
bool init_ok;
int hs1101pin;
float getHumidity_HS1101(int pin);
int get_mapped(const unsigned int* _in, const unsigned int* _out, byte size,int val);
//from HS1101 datasheet
const unsigned int out_humidity[HUMARRAYSIZE] = {1000,900,800,700,600,500,400,300,200,100,0}; //*10, gets later devided by 10
const unsigned int in_hs1101frequency[HUMARRAYSIZE] = {6033,6186,6330,6468,6600,6728,6853,6976,7100,7224,7351};
//unsigned int out_humidity[HUMARRAYSIZE];
//unsigned int in_hs1101frequency[HUMARRAYSIZE];
Sensor_HS1101(int pin);
void init();
void setSettings(float minchange, unsigned long senddelaymax, unsigned long readdelay);
void advertise(HomieNode& p_sensorNode);
void sensorloop();