Batería#
Introducción#
The battery class is derived from the brain base class and provides access to the IQ (2nd gen) Brain’s battery, allowing your robot to monitor capacity, voltage, current draw, power usage, temperature, and efficiency.
Acceso#
Brain.Battery
Funciones de los miembros#
The battery class includes the following member functions:
capacity— Returns the brain’s remaining battery capacity.voltage— Returns the battery voltage.current— Returns the battery current draw.
Before calling any battery member functions, a brain instance must be created, as shown below:
// Create the Brain
brain Brain = brain();
capacidad#
Devuelve el nivel de batería restante de la batería cerebral IQ (2.ª generación).
Available Functionsuint32_t capacity( percentUnits units = percentUnits::pct );
Parámetro |
Tipo |
Descripción |
|---|---|---|
|
|
Optional. The unit used to represent battery capacity: |
Returns a uint32_t representing the remaining battery capacity as a percentage from 0 to 100.
Voltaje#
Devuelve el voltaje de la batería del cerebro IQ (2.ª generación). El voltaje es la presión eléctrica que recibe la batería, lo que puede ayudarte a comprobar si tiene suficiente carga para que el robot funcione correctamente.
Available Functionsdouble voltage( voltageUnits units = voltageUnits::volt );
Parámetro |
Tipo |
Descripción |
|---|---|---|
|
|
Optional. The unit used to represent voltage: |
Returns a double representing the battery voltage in the specified units, ranging from 7.0 to 8.0 V or 7000 to 8000 mV.
actual#
Devuelve la corriente eléctrica extraída de la batería del robot IQ (2.ª generación). La corriente indica la cantidad de flujo eléctrico que el robot está utilizando de la batería, lo que puede ayudarte a ver con qué intensidad está trabajando o si los motores están sometidos a una carga excesiva.
Available Functionsdouble current( currentUnits units = currentUnits::amp );
Parámetro |
Tipo |
Descripción |
|---|---|---|
|
|
Optional. The unit used to represent current: |
Returns a double representing the electrical current drawn from the IQ (2nd gen) Brain battery in amperes, ranging from 0.0 to 15.0 Amps.