保险杠#

介绍#

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

以下是可用模块列表:

  • 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] 按下了?>

参数

描述

保险杠传感器

需要检查保险杠传感器。

例子

当开始 :: hat events
[Back up and turn whenever the bumper runs into an object.]
永久循环
驱动 [向前 v]
如果 <[LeftBumper v] 按下了?> 那么
驱动 [反 v] (100) [毫米 v] ▶
[右 v] 转 (90) 度 ▶

当保险杠#

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

当 [LeftBumper v] [pressed v] :: hat events

参数

描述

保险杠传感器

需要检查保险杠传感器。

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.

例子

当开始 :: hat events
驱动 [向前 v]

当 [LeftBumper v] [pressed v] :: hat events
[Reverse when the left bumper is pressed.]
驱动 [反 v] [200] [毫米 v] ▶