Cerebro#
In VEX IQ (2nd gen) C++, the Brain is represented by the brain class. You create (or use the default project-provided) Brain object and then access Brain features through its member objects.
Clases derivadas#
The brain class serves as a base class for the following derived classes:
Screen- This class provides access to the Brain’s built-in color touchscreen, allowing programs to display text, graphics, and receive touch input.Timer- This class provides high-resolution timing utilities for measuring elapsed time and controlling time-based behavior in programs.Battery- This class allows programs to monitor the Brain’s battery status, including voltage, current, capacity, and temperature.Button- This class provides access to the Brain’s buttons.SDcard- This class enables reading from and writing to the Brain’s SD card for file storage, data logging, and loading external resources.
Constructores de clases#
brain();
Parámetros#
The brain constructor uses no parameters.
Notas#
Only one
brainobject should be created in a project.
Ejemplo#
// Create the Brain
brain Brain = brain();
Funciones de los miembros#
The brain class includes the following member functions:
playSound- Plays one of the Brain’s built-in sound effects.playNote- Play a musical note from the Brain.
Before calling any brain member functions, a brain instance must be created, as shown below:
// Create the Brain
brain Brain = brain();
reproducir sonido#
Reproduce uno de los sonidos integrados del Brain.
Available Functionsvoid playSound(
soundtype sound );
Parámetros |
Tipo |
Descripción |
|---|---|---|
|
|
El sonido especificado que debe reproducirse desde el Cerebro. |
Nombre del sonido |
Reproducir sonido |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Esta función no devuelve ningún valor.
playNote#
Reproduce una nota musical del Cerebro.
Available Functionsvoid playNote(
soundtype sound );
1 - Toca una nota musical.
void playNote( int32_t octave int32_t note );
Parameters2 - Toca una nota musical durante una duración específica.
void playNote( int32_t octave, int32_t note, int32_t duration );
Parámetros |
Tipo |
Descripción |
|---|---|---|
|
|
The integer that represents the octave the note is played in:
|
|
|
The note to play:
|
|
|
Opcional. Duración en milisegundos para reproducir la nota, hasta un máximo de 500 milisegundos. Si no se especifica ninguna duración, la predeterminada es de 500 milisegundos. |
Esta función no devuelve ningún valor.