pyupm_vdiv module

class pyupm_vdiv.VDiv(pin)[source]

Bases: object

API for the Voltage Divider Sensor.

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

C++ includes: vdiv.hpp

computedValue(gain, val, vref=4980, res=1024)[source]

float computedValue(uint8_t gain, unsigned int val, int vref=VDIV_VREF, int res=VDIV_ADC_RES)

Computes the measured voltage

gain: Gain switch, example: either 3 or 10 grove vdiv

val: Measured voltage (from value())

vref: Reference voltage in millivolts

res: ADC resolution

Measured voltage

value(samples)[source]

unsigned int value(unsigned int samples)

Gets the conversion value from the sensor

samples: Specifies how many samples to average over

Average ADC conversion value