Interruptor de 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

<[Bumper 1 v] presionado?>

Parámetros

Descripción

interruptor de parachoques

El interruptor de parachoques para comprobar, configurado en la ventana Dispositivos.

Ejemplo

cuando empezó
[Back up and turn whenever the bumper runs into an object.]
para siempre
unidad [adelante v]
si <[Bumper 1 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 [Bumper 1 v] [presionado v]

Parámetros

Descripción

interruptor de parachoques

El interruptor de parachoques para comprobar, configurado en la ventana Dispositivos.

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 [Bumper 1 v] [presionado v]
[Move forward when Bumper Switch is pressed.]
unidad [adelante v] para [200] [mm v] ▶