readAnalogSensor - VCSFA-MARS/TSLPB GitHub Wiki
Overview
This method returns the raw value from the specified analog sensor.
uint16_t TSLPB::readAnalogSensor(TSLPB_AnalogSensor_t sensorName)
Returns
uint16_t containing raw value of the Arduino Pro Mini's ADC (integer between 0 and 1023)
The TSLPB uses a 10-bit Analog-to-Digital Converter. The 6 MSbs of the return value will always be 0.
Arguments
sensorName : TSLPB_AnalogSensor_t Sensor Name enum
TSLPB_AnalogSensor_t is an enum of all the built-in analog sensors on the TSLPB
typedef enum
{
Solar = 0b000, ///< 0b000 (Solar Sensor)
IR = 0b001, ///< 0b001 (IR)
TempInt = 0b010, ///< 0b010 (Temp Int)
TempExt = 0b011, ///< 0b011 (Temp Ext)
Current = 0b100, ///< 0b100 (Current)
Voltage = 0b101 ///< 0b101 (Vcc)
} TSLPB_AnalogSensor_t;
Usage
TSLPB tslpb;
uint16_t myCurrent = tslpb.readAnalogSensor(Current);