upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
API for the DFRobot ORP (Oxidation/Reduction Potential) Sensor. More...
This library was tested with the DFRobot ORP (Oxidation/Reduction Potential) Sensor.
To calibrate:
Disconnect the sensor probe (but leave the sensor interface board connected). Then run one of the examples while holding down the 'calibrate' button on the device. Read the ORP value reported (it should be fairly small).
This value is what you should supply to setCalibrationOffset(). Then reconnect the probe to the interface board and you should be ready to go.
DO NOT press the calibrate button on the interface board while the probe is attached or you can permanently damage the probe.
Public Member Functions | |
DFRORP (int apin, float a_ref=5.0) | |
~DFRORP () | |
void | update () |
void | setOffset (float offset) |
void | setScale (float scale) |
float | getORP () |
void | setCalibrationOffset (float offset) |
float | getVolts () |
float | getNormalized () |
Protected Attributes | |
dfrorp_context | m_dfrorp |
DFRORP | ( | int | apin, |
float | a_ref = 5.0 |
||
) |
DFRORP object constructor
apin | Analog pin to use |
a_ref | The analog reference voltage in use. Default 5.0. |
void update | ( | void | ) |
Read the sensor status an update internal state. update() must have been called before calling getORP(), getNormalized(), or getVolts().
void setOffset | ( | float | offset | ) |
Set sensor offset. This offset is applied to the return ORP value before scaling. Default is 0.0.
offset | The offset to apply. |
void setScale | ( | float | scale | ) |
Set sensor scale. The return ORP value is scaled by this value before the offset is applied. Default is 1.0.
scale | The scale to apply. |
float getORP | ( | ) |
Get computed ORP (in millivolts) value from the sensor. update() must have been called prior to calling this function.
void setCalibrationOffset | ( | float | offset | ) |
Set the calibration offset for the device. This is determined by disconnecting the sensor probe (but leaving the sensor interface board connected). Then run one of the examples while holding down the 'calibrate' button on the device. Read the ORP value reported.
This (low) ORP value is what you should supply to this function. Then reconnect the probe to the interface board and you should be ready to go.
DO NOT press the calibrate button on the interface board while the probe is attached or you can permanently damage the probe.
offset | The ORP offset obtained during calibration. |
float getVolts | ( | ) |
Get the measured volts from the sensor. update() must have been called prior to calling this function.
float getNormalized | ( | ) |
Get the normalized ADC value from the sensor. update() must have been called prior to calling this function.