Get the servo voltage

Reads the current voltage from the OpenServo power supply. Reading the voltage is a two stage process. You must first request a voltage reading, and then read the new voltage sample.

[Add information about range of scaling on voltage]

Reading the OpenServo requires two I2C transactions. The first sets the register to be read, and the second is the read transaction.

16bit precision

0x18

VOLTAGE_HI

Read Only

Battery Voltage value high byte

0x19

VOLTAGE_LO

Read Only

Battery Voltage value low byte

Read the voltage from the OpenServo. This is the exact voltage of the OpenServo at the time of reading.

In order to get the current power usage you must request a sample, and then get a 16 bit registers. Assuming device = 0x10

Get the voltage:

First request a new sample

8 bit command

0x90

VOLTAGE_READ

Request a new Voltage sample

VOLTAGE_READ = 0x90
send  [device VOLTAGE_READ]
send [0x10 0x90]

Read the sampled voltage. It is normally a good idea to leave a small delay before reading to allow 10ms for a new voltage sample.

VOLTAGE_HI = 0x18 VOLTAGE_LO = 0x19
send  [device VOLTAGE_HI]
read  [device {voltage_hi} {voltage_lo}]
send [0x10 0x18]
read [0x10 {voltage_hi} {voltage_lo}]