fishtankmonitor/sensors.h

30 lines
No EOL
700 B
C++

#ifndef Sensors_h
#define Sensors_h
#include <Wire.h>
#include <Adafruit_ADS1015.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <PubSubClient.h>
#include "Networking.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;
DallasTemperature* _ds18b20;
Networking* _networking;
public:
Sensors(int temperaturePin, char *temperatureTopic, char *phTopic, Networking *networking, DallasTemperature* ds18b20);
void setup();
float readpH();
void publishpH();
void publishTemperature();
};
#endif