Brain#
In VEX IQ (1st 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.
Derived Classes#
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.
Class Constructors#
brain();
Parameters#
The brain constructor uses no parameters.
Notes#
Only one
brainobject should be created in a project.
Example#
// Create the Brain
brain Brain = brain();
Member Functions#
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();
playSound#
Plays one of the Brain’s built-in sounds.
Available Functionsvoid playSound(
soundtype sound );
Parameters |
Type |
Description |
|---|---|---|
|
|
The specified sound to play from the Brain. |
Sound Name |
Play Sound |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This function does not return a value.
playNote#
Plays a musical note from the Brain.
Available Functionsvoid playNote(
soundtype sound );
1 — Play a musical note.
void playNote( int32_t octave int32_t note );
Parameters2 — Play a musical note for a specific duration.
void playNote( int32_t octave, int32_t note, int32_t duration );
Parameters |
Type |
Description |
|---|---|---|
|
|
The integer that represents the octave the note is played in:
|
|
|
The note to play:
|
|
|
Optional. The duration in milliseconds to play the note for, up to a max of 500 milliseconds. If no duration is provided, the default duration is 500 milliseconds. |
This function does not return a value.