18#define EZO_I2C_ADDR 99
19#define EZO_I2C_SHALLOW_ADDR 0x01
20#define EZO_I2C_MIDDLE_ADDR 0x02
21#define EZO_I2C_DEEP_ADDR 0x03
78 double getpH(
double){
return 0.0;}
91 Serial.print(
"\treading from address ");
97 Wire.endTransmission();
107 Serial.println(
"Success");
115 Serial.println(
"Pending");
119 Serial.println(
"No Data");
123 Serial.println(
"unknown code");
126 while(
Wire.available()){
160 this->
getpH(address);
165 void clear_pH_str(
void){
175 return "atlas_ezo_ph";
184 return "\"PH_RAW\": " + std::to_string(
voltage) +
", \"PH\":" + std::to_string(this->
getpH(voltage));
#define EZO_I2C_ADDR
Default I2C address for sensor.
Definition Atlas_EZO-pH.hpp:18
Defines an I2C pH sensor which inherits from pHSensor.hpp.
Definition Atlas_EZO-pH.hpp:34
double getpH(int address)
Reads pH value from sensor as a double on the pH scale.
Definition Atlas_EZO-pH.hpp:88
byte in_char
used as a 1 byte buffer to store inbound bytes from the pH Circuit.
Definition Atlas_EZO-pH.hpp:40
double getpH()
Returns a pH measurement from the default sensor address.
Definition Atlas_EZO-pH.hpp:149
byte i
counter used for ph_data array.
Definition Atlas_EZO-pH.hpp:41
char ph_data[32]
we make a 32 byte character array to hold incoming data from the pH circuit.
Definition Atlas_EZO-pH.hpp:39
byte code
used to hold the I2C response code.
Definition Atlas_EZO-pH.hpp:38
byte received_from_computer
we need to know how many characters have been received.
Definition Atlas_EZO-pH.hpp:36
bool sensor_at_address(int address)
Check if sensor present at address.
Definition Atlas_EZO-pH.hpp:64
double getpH(double)
Convert voltage reading to pH value.
Definition Atlas_EZO-pH.hpp:78
int address
default i2c address
Definition Atlas_EZO-pH.hpp:42
std::string toJSON(double voltage)
Converts a pH voltage reading to a JSON object string for MQTT and debugging.
Definition Atlas_EZO-pH.hpp:183
char * getpH_str(int address)
Get the pH reading as a string.
Definition Atlas_EZO-pH.hpp:158
std::string getSensorType(void)
Get the string identifier for the Atlas EZO pH sensor. For use in MQTT topics and debugging.
Definition Atlas_EZO-pH.hpp:174
byte serial_event
a flag to signal when data has been received from the pc/mac/other.
Definition Atlas_EZO-pH.hpp:37
Interface for pH sensors.
Definition pHSensor.hpp:19
Implements an interface for converting a voltage (analog reading) into a pH value according to the co...
int reset_count
number of resets retrieved for NVS
Definition scheduler.hpp:31