Move sensors in to own code file
This commit is contained in:
parent
9c01dc2435
commit
9ebb45cdbe
4 changed files with 84 additions and 59 deletions
27
sensors.h
Normal file
27
sensors.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <Wire.h>
|
||||
#include <Adafruit_ADS1015.h>
|
||||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
#include <PubSubClient.h>
|
||||
|
||||
#define PH_7_VOLTAGE 2.5
|
||||
#define PH_4_VOLTAGE 3.04
|
||||
#define VOLTAGE_OFFSET 0.03
|
||||
|
||||
class Sensors {
|
||||
int _temperaturePin;
|
||||
char *_temperatureTopic;
|
||||
char *_phTopic;
|
||||
float _pHStep = (PH_7_VOLTAGE - PH_4_VOLTAGE) / 3;
|
||||
Adafruit_ADS1115 _ads;
|
||||
//OneWire _oneWire;
|
||||
DallasTemperature _ds18b20;
|
||||
PubSubClient _mqttClient;
|
||||
|
||||
public:
|
||||
Sensors(int temperaturePin, char *temperatureTopic, char *phTopic, PubSubClient mqttClient);
|
||||
void setup();
|
||||
float readpH();
|
||||
void publishpH();
|
||||
void publishTemperature();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue