Parachoques#

Introducción#

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

A continuación se muestra una lista de bloques disponibles:

  • Bumper pressed — Reports a Boolean indicating if the Bumper Switch is being pressed.

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

Bumper pressed#

The Bumper pressed Boolean block reports whether or not a Bumper Switch is being pressed. This can be used to check if the robot bumps into other objects.

  • True — The Bumper Switch is being pressed.

  • False — The Bumper Switch is not being pressed

<[LeftBumper v] presionado?>

Parámetros

Descripción

sensor de parachoques

El sensor del parachoques para comprobar.

Ejemplo

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 ▶

Cuando parachoques#

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

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

Parámetros

Descripción

sensor de parachoques

El sensor del parachoques para comprobar.

state

When the attached stack of blocks will run: pressed will run when the Bumper Switch is pressed down, and released runs when the Bumper Switch is released.

Ejemplo

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] ▶