5 pinMode(this->_ph_level_pin, INPUT);
6 pinMode(this->_temp_pin, INPUT);
10 this->_calibration = calibration;
16 for(
int i = 0; i < this->_reading_count; i++) {
17 reading += analogRead(this->_ph_level_pin);
18 delayMicroseconds(this->_reading_interval);
22 reading /= this->_reading_count;
29 float reading = analogRead(this->_ph_level_pin);
32 reading /= this->_reading_count;
38 return analogRead(this->_temp_pin);
int read_temp()
Read the temperature from the sensor.
void recalibrate(float calibration)
Recalibrate the sensor with a new calibration value.
float read_ph_level()
Read and calculate the pH level.
void init()
Initialize the PH4502C sensor.
float read_ph_level_single()
Read and calculate the pH level without averaging multiple readings.
Arduino Library for PH4502C Sensor.
#define PH4502C_VOLTAGE
Operating voltage for the PH4502C sensor.
#define PH4502C_PH_VOLTAGE_PER_PH
Rate of change in voltage per unit change in pH.
#define PH4502C_MID_VOLTAGE
Voltage that represents a neutral pH reading (pH = 7).