电池#
介绍#
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.
使用权#
Brain.Battery
成员功能#
The battery class includes the following member functions:
voltage— Returns the battery voltage.current— Returns the battery current draw.capacity— Returns the remaining battery capacity.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();
电压#
返回 V5 大脑电池的电压。
Available Functionsdouble voltage( voltageUnits units = voltageUnits::volt );
范围 |
类型 |
描述 |
|---|---|---|
|
|
Optional. The unit used to represent voltage:
|
Returns a double representing the battery voltage in the specified units.
当前的#
返回从 V5 大脑电池汲取的电流。
Available Functionsdouble current( currentUnits units = currentUnits::amp );
范围 |
类型 |
描述 |
|---|---|---|
|
|
Optional. The unit used to represent current:
|
Returns a double representing the electrical current drawn from the V5 Brain battery in amperes.
容量#
返回 V5 大脑电池的剩余电量。
Available Functionsuint32_t capacity( percentUnits units = percentUnits::pct );
范围 |
类型 |
描述 |
|---|---|---|
|
|
Optional. The unit used to represent battery capacity:
|
Returns a uint32_t representing the remaining battery capacity as a percentage from 0 to 100.
温度#
返回 V5 大脑电池的温度。
Available Functions1 — 返回电池温度的百分比。
double temperature( percentUnits units = percentUnits::pct );
Parameters2 — 返回指定温度单位的电池温度。
double temperature( temperatureUnits units );
范围 |
类型 |
描述 |
|---|---|---|
|
|
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).