脑#
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.
派生类#
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.
类构造函数#
brain();
参数#
The brain constructor uses no parameters.
笔记#
Only one
brainobject should be created in a project.
例子#
// Create the Brain
brain Brain = brain();
成员功能#
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();
播放声音#
播放大脑内置的声音之一。
Available Functionsvoid playSound(
soundtype sound );
参数 |
类型 |
描述 |
|---|---|---|
|
|
大脑要播放的指定声音。 |
声音名称 |
播放声音 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
此函数不返回值。
播放音符#
从大脑中发出一个音符。
Available Functionsvoid playNote(
soundtype sound );
1 - 演奏一个音符。
void playNote( int32_t octave int32_t note );
Parameters2 - 演奏特定时长的音符。
void playNote( int32_t octave, int32_t note, int32_t duration );
参数 |
类型 |
描述 |
|---|---|---|
|
|
The integer that represents the octave the note is played in:
|
|
|
The note to play:
|
|
|
可选。音符的持续时间(以毫秒为单位),最长为 500 毫秒。如果未提供持续时间,则默认持续时间为 500 毫秒。 |
此函数不返回值。