PaleoTerraRedox class

The Sensor sub-class for the PaleoTerra redox sensor.

Base classes

class Sensor
The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.

Constructors, destructors, conversion operators

PaleoTerraRedox(SoftwareWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1)
Construct a new PaleoTerra Redox object using a software I2C instance.
PaleoTerraRedox(int8_t powerPin, int8_t dataPin, int8_t clockPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1)
Construct a new PaleoTerra Redox object, also creating a SoftwareWire I2C instance for communication with that object.
PaleoTerraRedox(TwoWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1)
Construct a new PaleoTerra Redox object using a secondary hardware I2C instance.
PaleoTerraRedox(int8_t powerPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1) explicit
Construct a new PaleoTerra Redox object using the primary hardware I2C instance.
~PaleoTerraRedox()
Destroy the PaleoTerra Redox object. Also destroy the software I2C instance if one was created.

Public functions

bool setup(void) -> bool override
Do any one-time preparations needed before the sensor will be able to take readings.
String getSensorLocation(void) -> String override
Get the pin or connection location between the mcu and the sensor.
bool addSingleMeasurementResult(void) -> bool override
Get the results from a single measurement.

Function documentation

PaleoTerraRedox::PaleoTerraRedox(SoftwareWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1)

Construct a new PaleoTerra Redox object using a software I2C instance.

Parameters
theI2C A SoftwareWire instance for I2C communication.
powerPin The pin on the mcu controlling power to the PaleoTerra redox sensor. Use -1 if it is continuously powered.
i2cAddressHex The I2C address of the redox probe.
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.

The constructor - need the power pin, optionally can give an instance of TwoWire for I2C communication, an address, and a number of measurements to average.


PaleoTerraRedox::PaleoTerraRedox(int8_t powerPin, int8_t dataPin, int8_t clockPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1)

Construct a new PaleoTerra Redox object, also creating a SoftwareWire I2C instance for communication with that object.

Parameters
powerPin The pin on the mcu controlling power to the PaleoTerra redox sensor. Use -1 if it is continuously powered.
dataPin The pin on the mcu that will be used for I2C data (SDA). Must be a valid pin number.
clockPin The pin on the mcu that will be used for the I2C clock (SCL). Must be a valid pin number.
i2cAddressHex The I2C address of the redox probe.
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.

PaleoTerraRedox::PaleoTerraRedox(TwoWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1)

Construct a new PaleoTerra Redox object using a secondary hardware I2C instance.

Parameters
theI2C A TwoWire instance for I2C communication. Due to the limitations of the Arduino core, only a hardware I2C instance can be used. For an AVR board, there is only one I2C instance possible and this form of the constructor should not be used. For a SAMD board, this can be used if a secondary I2C port is created on one of the extra SERCOMs.
powerPin The pin on the mcu controlling power to the PaleoTerra redox sensor. Use -1 if it is continuously powered.
i2cAddressHex The I2C address of the redox probe.
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.

PaleoTerraRedox::PaleoTerraRedox(int8_t powerPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1) explicit

Construct a new PaleoTerra Redox object using the primary hardware I2C instance.

Parameters
powerPin The pin on the mcu controlling power to the PaleoTerra redox sensor. Use -1 if it is continuously powered.
i2cAddressHex The I2C address of the redox probe.
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.

bool PaleoTerraRedox::setup(void) override

Do any one-time preparations needed before the sensor will be able to take readings.

Returns bool True if the setup was successful.

This begins the Wire library (sets pin levels and modes for I2C) and updates the _sensorStatus. No sensor power is required.


String PaleoTerraRedox::getSensorLocation(void) override

Get the pin or connection location between the mcu and the sensor.

Returns String Text describing how the sensor is attached to the mcu.

bool PaleoTerraRedox::addSingleMeasurementResult(void) override

Get the results from a single measurement.

Returns bool True if the function completed successfully.

This asks the sensor for a new result, verifies that it passes sanity range checks, and then adds the value to the result array.

This also un-sets the _millisMeasurementRequested timestamp (sets _millisMeasurementRequested to 0) and updates the _sensorStatus.