Εγκέφαλος#

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 brain object 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 Functions
void playSound(
    soundtype sound );

Parameters

Παράμετροι

Τύπος

Περιγραφή

sound

soundtype

Ο καθορισμένος ήχος που θα αναπαραχθεί από τον Εγκέφαλο.

Όνομα ήχου

Αναπαραγωγή ήχου

alarm

alarm2

doorClose

fillup

headlightsOff

headlightsOn

powerDown

ratchet

ratchet2

siren

siren2

tada

tollBooth

wrench

wrongWay

wrongWaySlow

Return Values

Αυτή η συνάρτηση δεν επιστρέφει τιμή.

playNote#

Παίζει μια μουσική νότα από τον Εγκέφαλο.

Available Functions

1 - Παίξε μια μουσική νότα.

void playNote(
    int32_t octave,
    int32_t note );

2 - Παίξτε μια μουσική νότα για μια συγκεκριμένη διάρκεια.

void playNote(
    int32_t octave,
    int32_t note,
    int32_t duration );

Parameters

Παράμετροι

Τύπος

Περιγραφή

octave

int32_t

The integer that represents the octave the note is played in:

  • 1 to 3 - low octave
  • 4 to 7 - high octave

note

int32_t

The note to play:

  • 0 - C
  • 1 - D
  • 2 - E
  • 3 - F
  • 4 - G
  • 5 - A
  • 6 - B

duration

int32_t

Προαιρετικό. Η διάρκεια σε χιλιοστά του δευτερολέπτου για την αναπαραγωγή της νότας, έως και 500 χιλιοστά του δευτερολέπτου. Εάν δεν παρέχεται διάρκεια, η προεπιλεγμένη διάρκεια είναι 500 χιλιοστά του δευτερολέπτου.

Return Values

Αυτή η συνάρτηση δεν επιστρέφει τιμή.