Battery#
Introduction#
The battery class is derived from the brain base class and provides access to the V5 Brain’s battery, allowing your robot to monitor capacity, voltage, current draw, power usage, temperature, and efficiency.
Access#
Brain.Battery
Member Functions#
The battery class includes the following member functions:
capacity— Returns the remaining battery capacity.voltage— Returns the battery voltage.current— Returns the battery current draw.temperature— Returns the battery temperature.
Before calling any battery member functions, a brain instance must be created, as shown below:
// Create the V5 Brain
brain Brain = brain();
capacity#
Returns the remaining capacity of the V5 Brain battery.
Available Functionsuint32_t capacity( percentUnits units = percentUnits::pct );
Parameter |
Type |
Description |
|---|---|---|
|
|
Optional. The unit used to represent battery capacity:
|
Returns a uint32_t representing the remaining battery capacity as a percentage from 0 to 100.
voltage#
Returns the voltage of the V5 Brain battery.
Available Functionsdouble voltage( voltageUnits units = voltageUnits::volt );
Parameter |
Type |
Description |
|---|---|---|
|
|
Optional. The unit used to represent voltage:
|
Returns a double representing the battery voltage in the specified units.
current#
Returns the electrical current drawn from the V5 Brain battery.
Available Functionsdouble current( currentUnits units = currentUnits::amp );
Parameter |
Type |
Description |
|---|---|---|
|
|
Optional. The unit used to represent current:
|
Returns a double representing the electrical current drawn from the V5 Brain battery in amperes.
temperature#
Returns the temperature of the V5 Brain battery.
Available Functions| 1 |
|
|
| 2 |
|
|
Parameter |
Type |
Description |
|---|---|---|
|
|
Optional. The unit used to represent battery temperature:
|
|
|
Returns the battery temperature in specific units:
|
Returns a double representing the remaining battery temperature in the specified units.
The operating temperature range for the battery is approximately
20°C(68°F) to70°C(158°F).