PH4502C-Sensor
|
Class for interfacing with the PH4502C pH sensor. More...
#include <ph4502c_sensor.h>
Public Member Functions | |
PH4502C_Sensor (uint16_t ph_level_pin, uint16_t temp_pin, float calibration=PH4502C_DEFAULT_CALIBRATION, int reading_interval=PH4502C_DEFAULT_READING_INTERVAL, int reading_count=PH4502C_DEFAULT_READING_COUNT, float adc_resolution=PH4502C_DEFAULT_ADC_RESOLUTION) | |
Construct a new PH4502C_Sensor object. | |
void | init () |
Initialize the PH4502C sensor. | |
void | recalibrate (float calibration) |
Recalibrate the sensor with a new calibration value. | |
float | read_ph_level () |
Read and calculate the pH level. | |
float | read_ph_level_single () |
Read and calculate the pH level without averaging multiple readings. | |
int | read_temp () |
Read the temperature from the sensor. | |
Class for interfacing with the PH4502C pH sensor.
This class provides the necessary functions to communicate with the PH4502C pH sensor. You can connect the pH level sensor and the temperature sensor to your Arduino using the constructor's parameters.
Definition at line 48 of file ph4502c_sensor.h.
|
inline |
Construct a new PH4502C_Sensor object.
ph_level_pin | Analog pin connected to the pH level output of the sensor. |
temp_pin | Analog pin connected to the temperature output of the sensor. |
calibration | Calibration value to adjust pH readings (default is PH4502C_DEFAULT_CALIBRATION). |
reading_interval | Time interval between consecutive pH level readings in milliseconds (default is PH4502C_DEFAULT_READING_INTERVAL). |
reading_count | Number of pH level readings to average when using read_ph_level() (default is PH4502C_DEFAULT_READING_COUNT). |
adc_resolution | ADC resolution used for voltage calculation from the analog read (default is PH4502C_DEFAULT_ADC_RESOLUTION). |
Definition at line 63 of file ph4502c_sensor.h.
void PH4502C_Sensor::init | ( | ) |
Initialize the PH4502C sensor.
This function sets up the necessary configurations for the sensor. It should be called in your setup() function.
Definition at line 4 of file ph4502c_sensor.cpp.
float PH4502C_Sensor::read_ph_level | ( | ) |
Read and calculate the pH level.
Definition at line 13 of file ph4502c_sensor.cpp.
float PH4502C_Sensor::read_ph_level_single | ( | ) |
Read and calculate the pH level without averaging multiple readings.
Definition at line 28 of file ph4502c_sensor.cpp.
int PH4502C_Sensor::read_temp | ( | ) |
Read the temperature from the sensor.
Definition at line 37 of file ph4502c_sensor.cpp.
void PH4502C_Sensor::recalibrate | ( | float | calibration | ) |
Recalibrate the sensor with a new calibration value.
calibration | The new pH calibration value. This function allows you to fine-tune the pH readings if your sensor's accuracy changes over time. |
Definition at line 9 of file ph4502c_sensor.cpp.