保险杠#

介绍#

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

VEX V5 碰撞开关,一款三线设备,黑色底座可安装/_static/img/sensing/bumper_switch_1_new_image.png机器人上,红色按钮可按下或松开。

以下是可用模块列表:

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

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

保险杠开关被按下了吗?#

The Bumper Switch 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

<[BumperA v] 按下了?>

范围

描述

设备

在“设备”窗口中配置要使用的碰撞开关。

当开始
[Display a message when the Bumper Switch is pressed.]
等到 <[BumperA v] 按下了?>
在屏幕上打印 [Bumper Switch pressed!]▶

当保险杠开关#

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

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

范围

描述

设备

在“设备”窗口中配置要使用的碰撞开关。

状态

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.

向前行驶,直到在 200 毫米范围内检测到物体为止#
当 [BumperA v] [pressed v]  :: hat events
[Display a message when the Bumper Switch is pressed.]
在屏幕上打印 [Bumper Switch pressed!]▶