#include <src/sensors/TIADS1x15.h>
TIADS1x15
class
The Sensor sub-class for the external votlage as measured by TI ADS1115 or ADS1015.
- Reference
- Detailed Descriptions
Base classes
- class Sensor
- The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.
Constructors, destructors, conversion operators
- TIADS1x15(int8_t powerPin, uint8_t adsChannel, float gain = 1, uint8_t i2cAddress = 0x48, uint8_t measurementsToAverage = 1)
- Construct a new External Voltage object - need the power pin and the data channel on the ADS1x15.
- ~TIADS1x15()
- Destroy the External Voltage object.
Public functions
- 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
TIADS1x15:: TIADS1x15(int8_t powerPin,
uint8_t adsChannel,
float gain = 1,
uint8_t i2cAddress = 0x48,
uint8_t measurementsToAverage = 1)
Construct a new External Voltage object - need the power pin and the data channel on the ADS1x15.
Parameters | |
---|---|
powerPin | The pin on the mcu controlling power to the sensor Use -1 if it is continuously powered. |
adsChannel | The ADS channel of interest (0-3). |
gain | The gain multiplier, if a voltage divider is used. |
i2cAddress | The I2C address of the ADS 1x15, default is 0x48 (ADDR = GND) |
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 gain value, I2C address, and number of measurements to average are optional. If nothing is given a 1x gain is used.
String TIADS1x15:: 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 TIADS1x15:: 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 _