API for the Voltage Divider Sensor.
More...
- ID: vdiv
- Name: Analog Voltage Divider Sensor
- Other Names: Grove Voltage Divider
- Category: electric
- Manufacturer: seeed
- Connection: analog
- Kit: robok
UPM module for the Voltage Divider sensor
while (shouldRun)
{
unsigned int val = vDiv->
value(100);
cout << "ADC value: " << val << " Gain 3: " << gain3val
<< "v Gain 10: " << gain10val << "v" << endl;
sleep(1);
}
|
| VDiv (int pin) |
|
| ~VDiv () |
|
unsigned int | value (unsigned int samples) |
|
float | computedValue (uint8_t gain, unsigned int val, int vref=VDIV_VREF, int res=VDIV_ADC_RES) |
|
Voltage Divider sensor constructor
- Parameters
-
Voltage Divider destructor
unsigned int value |
( |
unsigned int |
samples | ) |
|
Gets the conversion value from the sensor
- Parameters
-
samples | Specifies how many samples to average over |
- Returns
- Average ADC conversion value
float computedValue |
( |
uint8_t |
gain, |
|
|
unsigned int |
val, |
|
|
int |
vref = VDIV_VREF , |
|
|
int |
res = VDIV_ADC_RES |
|
) |
| |
Computes the measured voltage
- Parameters
-
gain | Gain switch, example: either 3 or 10 grove vdiv |
val | Measured voltage (from value()) |
vref | Reference voltage in millivolts |
res | ADC resolution |
- Returns
- Measured voltage
The documentation for this class was generated from the following files: