Cerebro#

Introducción#

La categoría de detección cerebral VEX IQ (2.ª generación) ofrece métodos para interactuar con los botones del cerebro y la batería conectada.

A continuación se muestra una lista de todos los métodos disponibles:

Acciones: interactúa con los botones de VEX IQ (2.ª generación).

  • pressed – Calls a function when the specified button is pressed.

  • released – Calls a function when the specified button is released.

Getters – Devuelven datos de los botones y la batería.

  • capacity – Returns the remaining battery capacity as a percentage.

  • pressing – Returns whether the specified button is being pressed.

  • voltage – Returns the battery voltage in volts.

  • current – Returns the battery current in amps.

Constructores: inicializan manualmente el cerebro.

  • brain – Create a Brain.

Comportamiento#

pressed#

pressed registers a function to be called when a specific button on the Brain is pressed. This method must be called on a specific button object, such as buttonCheck – (see full list of button objects below).

Uso:
Se puede usar uno de los tres objetos de botón disponibles con este método, como se muestra a continuación:

Botón

Dominio

buttonCheck

Brain.buttonCheck.pressed(callback); — The Check button

buttonLeft

Brain.buttonLeft.pressed(callback); — The Left button

buttonRight

Brain.buttonRight.pressed(callback); — The Right button

Parámetros

Descripción

callback

Una función que se define previamente para ejecutarse cuando se presiona el botón especificado.

// Example coming soon

released#

released registers a function to be called when a specific button on the Brain is released. This method must be called on a specific button object, such as buttonCheck – (see full list of button objects below).

Uso:
Se puede usar uno de los tres objetos de botón disponibles con este método, como se muestra a continuación:

Botón

Dominio

buttonCheck

Brain.buttonCheck.released(callback); — The Check button

buttonLeft

Brain.buttonLeft.released(callback); — The Left button

buttonRight

Brain.buttonRight.released(callback); — The Right button

Parámetros

Descripción

callback

Una función que se define previamente para ejecutarse cuando se presiona el botón especificado.

// Example coming soon

Captadores#

capacity#

capacity returns the remaining battery capacity of the Brain as a percentage.

Usage:
Brain.Battery.capacity(units)

Parámetros

Descripción

units

The unit that represents the capacity:

  • percent
// Example coming soon

pressing#

pressing returns a Boolean indicating whether a specific button on the Brain is currently being pressed. This method must be called on a specific button object, such as buttonCheck (see full list of button objects below).

  • 1 - The specified button is being pressed.

  • 0 - The specified button is not being pressed.

Uso:
Se puede usar uno de los tres objetos de botón disponibles con este método, como se muestra a continuación:

Botón

Dominio

buttonCheck

Brain.buttonCheck.pressing() — The Check button

buttonLeft

Brain.buttonLeft.pressing() — The Left button

buttonRight

Brain.buttonRight.pressing() — The Right button

Parámetros

Descripción

Este método no tiene parámetros.

// Example coming soon

voltage#

voltage returns the Brain’s battery voltage in volts.

Usage:
Brain.Battery.voltage()

Parámetros

Descripción

Este método no tiene parámetros.

// Example coming soon

current#

current returns the Brain’s battery current in amps.

Usage:
Brain.Battery.current()

Parámetros

Descripción

Este método no tiene parámetros.

// Example coming soon

Constructores#

brain#

brain creates an object of the brain Class.

Usage:
brain Brain;

Parámetro

Descripción

Este constructor no tiene parámetros.

// Example coming soon