vex.brain package¶
VEX Brain.
- class vex.brain.Brain[source]¶
Bases:
SingletonDeviceVEX Brain.
ROBOT MESH PYTHON B:
Use the Brain class to see battery information, or write to the screen.
robotmesh.com/studio/content/docs/vexiq-python_b/html/classvex_1_1_brain.html
- property buttonCheck: BrainButton¶
Brain Button CHECK.
- property buttonDown: BrainButton¶
Brain Button DOWN.
- property buttonUp: BrainButton¶
Brain Button UP.
- property sound: BrainSound¶
Brain Sound.
- class vex.brain.BrainButton(id: str)[source]¶
Bases:
objectBrain Button.
ROBOT MESH PYTHON B:
Use the Button class to get values from the Brain’s buttons.
robotmesh.com/studio/content/docs/vexiq-python_b/html/classvex_1_1_brain_button.html
- pressing() bool[source]¶
Return Button’s pressed status.
VEXCODE PYTHON:
Reports if the specified button on the VEX IQ Brain is being pressed.
Reports True if the specified Brain button is pressed. Reports False if the specified Brain button is not pressed.
After brain. enter a Brain button to receive the pressed status on.
Supported Brain buttons are as follows: - buttonUp / buttonLeft - buttonDown / buttonRight - buttonCheck
ROBOT MESH PYTHON B:
Get the pressed status of a button.
Returns: True if pressed, False otherwise.
- class vex.brain.BrainLcd[source]¶
Bases:
SingletonDeviceBrain LCD Screen.
ROBOT MESH PYTHON B:
Use this class to write or draw to the brain’s LCD screen.
21 characters wide
5 lines (1-5)
robotmesh.com/studio/content/docs/vexiq-python_b/html/classvex_1_1_brain_lcd.html
- clear_screen()[source]¶
Clear Brain LCD Screen.
VEXCODE PYTHON:
Clears the entire VEX IQ Brain’s Screen.
Clear Screen will not reset the Brain’s screen cursor.
Use the Set Cursor command to set the Brain’s cursor to the desired position.
ROBOT MESH PYTHON B:
Clear the whole screen.
- print_line(number: int, text: str)[source]¶
Print to a line on Brain LCD Screen.
ROBOT MESH PYTHON B:
Print a number, string, or boolean at a particular line.
(clearing the rest of the line)
Parameters number: Line to print on, 1 is top line. text: object to print, usually a string.
Use “” to clear the line. For multiple arguments, use format like “x: %g y: %g” % (x, y) -> “x: 123 y: 456” Supported format flags are g (all) x (hex) d (int) f (float)
- class vex.brain.BrainSound[source]¶
Bases:
SingletonDeviceBrain Sound.
ROBOT MESH PYTHON B:
robotmesh.com/studio/content/docs/vexiq-python_b/html/classvex_1_1_brain_sound.html
- play(note: NoteType, octave: int = 3, duration: float = 0.5, timeUnits: TimeUnits = TimeUnits.SEC)[source]¶
Play note/sound on Brain Sound Speaker.
ROBOT MESH PYTHON B:
Play a musical note on the speaker.
Parameters: - note: musical note to play: NoteType enum value - octave: octave of the note [1-7], optional - duration: time. 0 to start playing without blocking. Default 0.5 - timeUnits: of time for the duration. Default sec.
- play_melody(melody: str)[source]¶
Play musical melody.
ROBOT MESH PYTHON B:
Play a melody form a string in a quasi musical alphabet notation.
(cdefgab)
Parameters: - melody: string [cdefgab]: musical alphabet for notes,
space: pause, +/-: increase/decrease octave of following notes 0-9: set duration of following notes
(in 1/8s: 1=eighth note…8 = full note)
- play_raw(note: NoteType, duration: float = 0.5, timeUnits: TimeUnits = TimeUnits.SEC)[source]¶
Play note/sound on Brain Sound Speaker.
ROBOT MESH PYTHON B:
Play a musical note on the speaker.
Parameters - note: musical note to play: 0=silence/stop, [1-56] numeric value - duration: time. 0 to start playing without blocking. Default 0.5 - timeUnits: of time for the duration. Default sec.
- play_wave(waveType: int, waitForCompletion: bool = True)[source]¶
Play WAV.
ROBOT MESH PYTHON B:
Play the wave sample.
Parameters: - waveType: type of the wave sample sound to play [0..15] - waitForCompletion: wait for the sample to finish playing
- set_sound_effect(effect: int)[source]¶
Set Sound Effect.
ROBOT MESH PYTHON B:
Set the sound effect type for subsequent notes played.
Parameters - effect: effect type [0..15]
- class vex.brain.NoteType(value)[source]¶
Bases:
IntEnumMusical Note.
ROBOT MESH PYTHON B:
Musical note to play.
robotmesh.com/studio/content/docs/vexiq-python_b/html/classvex_1_1_note_type.html
- A: int = 6¶
- B: int = 7¶
- C: int = 1¶
- D: int = 2¶
- E: int = 3¶
- F: int = 4¶
- G: int = 5¶
- silence: int = 0¶
- class vex.brain.SoundType(value)[source]¶
Bases:
EnumSound Effect.
VEXCODE PYTHON:
Sound Effect
- ALARM = 8¶
- ALARM2 = 15¶
- DOOR_CLOSE = 10¶
- FILLUP = 4¶
- HEADLIGHTS_OFF = 6¶
- HEADLIGHTS_ON = 5¶
- POWER_DOWN = 16¶
- RATCHET = 11¶
- RATCHET2 = 14¶
- SIREN = 1¶
- SIREN2 = 13¶
- TADA = 9¶
- TOLLBOOTH = 7¶
- WRENCH = 12¶
- WRONG_WAY = 2¶
- WRONG_WAY_SLOW = 3¶