Bumper#

Introduction#

The Bumper is a mechanical switch that completes a circuit when pressed, allowing the robot to detect presses and releases.

Below is a list of available blocks:

  • bumper pressed? – Returns a Boolean whether the Bumper Sensor is being pressed.

  • when Bumper – Executes the attached stack of blocks when the Bumper Sensor is pressed or released.

Bumper pressed?#

The bumper pressed? block returns if a Bumper Sensor is currently being pressed or not pressed. This block returns a Boolean value:

  • True - The Bumper Sensor is being pressed.

  • False - The Bumper Sensor is not being pressed

<[LeftBumper v] presionado?>

Parameters

Description

bumper sensor

The Bumper Sensor to check.

Example

cuando empezó :: hat events
[Back up and turn whenever the bumper runs into an object.]
para siempre
unidad [adelante v]
si <[LeftBumper v] presionado?> entonces
unidad [atrás v] para (100) [mm v] ▶
girar [derecha v] por (90) grado ▶

when Bumper#

The when Bumper block runs the attached stack of blocks when the selected Bumper Sensor is pressed or released.

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

Parameters

Description

bumper sensor

The Bumper Sensor to check.

actions

Determines when the attached stack of blocks will execute:

  • pressed
  • released

Example

cuando empezó :: hat events
unidad [adelante v]

cuando [LeftBumper v] [presionado v] :: hat events
[Reverse when the left bumper is pressed.]
unidad [atrás v] para [200] [mm v] ▶