Button#

Introduction#

The VEX 123 Robot has four buttons: Left, Right, Move, and Sound. The Button methods check whether a button is being pressed.

Below is a list of all methods:

Getter — Check if a button is pressed.

  • get_button — Returns whether a specified button is currently being pressed.

Getter#

get_button#

get_button returns a Boolean that reports whether the specified button is currently being pressed.

  • True — The button is being pressed.

  • False — The button is not being pressed.

Usage:
robot.get_button(button)

Parameter

Description

button

The button to check:

  • LEFT
  • MOVE
  • RIGHT
  • SOUND

# Drive after the sound button is pressed.
while not robot.get_button(SOUND):
    wait(0.05, SECONDS)
robot.drive(FORWARD)