Bumper Switch#

Introduction#

The Bumper Switch is a spring-loaded digital sensor that detects physical contact or impact with an object.

The VEX V5 Bumper Switch that is red.

Below is a list of available blocks:

  • Bumper Switch pressed? – Returns whether the specified Bumper Switch is currently pressed.

  • when Bumper Switch – Runs the attached stack of blocks when the specified Bumper Switch is pressed or released.

Bumper Switch pressed?#

The Bumper Switch pressed? block returns a Boolean indicating whether the Bumper Switch is currently being pressed.

  • True – The Bumper Switch is being pressed.

  • False – The Bumper Switch is not being pressed.

<[BumperSwitchA v] presionado?>

Parameter

Description

device

Which Bumper Switch to use, configured in the Devices window.

cuando empezó
[Display a message when the Bumper Switch is pressed.]
esperar hasta <[BumperSwitchA v] presionado?>
imprimir [Bumper Switch pressed!] en la pantalla ▶

when Bumper Switch#

The when Bumper Switch block runs the attached stack when the specified Bumper Switch is pressed or released.

cuando [BumperSwitchA v] [presionado v]  :: hat events

Parameter

Description

device

Which Bumper Switch to use, configured in the Devices window.

state

When to run the attached stack of blocks:

  • pressed
  • released

Drive forward until an object is detected within 200 mm#
cuando [BumperSwitchA v] [presionado v]  :: hat events
[Display a message when the Bumper Switch is pressed.]
imprimir [Bumper Switch pressed!] en la pantalla ▶