Bumper Switch#
Introduction#
The Bumper category includes blocks that monitor the VEX IQ Bumper Switch. The Bumper Switch is a mechanical switch that completes a circuit when pressed, allowing the robot to detect presses and releases.
Below is a list of available blocks:
Bumper pressed? — Returns a Boolean whether the Bumper Switch is being pressed.
when Bumper — Executes the attached stack of blocks when the Bumper Switch is pressed or released.
Bumper pressed?#
The Bumper pressed? block returns a Boolean indicating whether a Bumper Switch is being pressed.
True — The Bumper Switch is being pressed.
False — The Bumper Switch is not being pressed
<[Bumper 1 v] 按下了?>
Parameters |
Description |
|---|---|
bumper switch |
The Bumper Switch to check, configured in the Devices window. |
Example
当开始
[Back up and turn whenever the bumper runs into an object.]
永久循环
驱动 [向前 v]
如果 <[Bumper 1 v] 按下了?> 那么
驱动 [反 v] (100) [毫米 v] ▶
[右 v] 转 (90) 度 ▶
when Bumper#
The when Bumper block runs the attached stack of blocks when the selected Bumper Switch is pressed or released.
当 [Bumper 1 v] [pressed v]
Parameters |
Description |
|---|---|
bumper switch |
The Bumper Switch to check, configured in the Devices window. |
actions |
Determines when the attached stack of blocks will execute:
|
Example
当 [Bumper 1 v] [pressed v]
[Move forward when Bumper Switch is pressed.]
驱动 [向前 v] [200] [毫米 v] ▶