保险杠开关#

介绍#

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

<[Bumper 1 v] 按下了?>

参数

描述

保险杠开关

要检查的保险杠开关,在设备窗口中配置。

例子

当开始
[Back up and turn whenever the bumper runs into an object.]
永久循环
驱动 [向前 v]
如果 <[Bumper 1 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.

当 [Bumper 1 v] [pressed v]

参数

描述

保险杠开关

要检查的保险杠开关,在设备窗口中配置。

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.

例子

当 [Bumper 1 v] [pressed v]
[Move forward when Bumper Switch is pressed.]
驱动 [向前 v] [200] [毫米 v] ▶