LED Bumper#

介绍#

LED 保险杠可以检测何时被按下,并可以改变其颜色或图案以提供视觉反馈。

以下是所有模块的列表:

Set Bumper color#

The Set Bumper color stack block tells the LED Bumper what color to be, or to turn off.

The LED Bumper can be used to track where the robot is at in a project or to show when certain conditions are met.

设定 [bumper v] 为 [红色 v]

参数

描述

引领

在设备窗口中配置所选的 LED 保险杠以改变其颜色。

颜色

The color to set the LED Bumper to:

  • red
  • green
  • off — Turns the LED off

例子

当开始 :: hat events
[Build Used: Super Code Base 2.0]
[Blink the LED off and on.]
永久循环
设定 [bumper v] 为 [绿色 v]
等待 [0.5] 秒
设定 [bumper v] 为 [灭 v]
等待 [0.5] 秒

Set Bumper brightness#

The Set Bumper brightness stack block tells the LED Bumper what brightness to be.

A higher percentage makes the light brighter. A lower percentage makes the light dimmer.

If the LED Bumper is off, setting the light power above 0% will turn the light on.

If the LED Bumper is on, setting the light power at 0% will turn the light off.

设定 [bumper v] 亮度为 [50]%

参数

描述

引领

在设备窗口中配置所选的 LED 保险杠以改变其亮度。

亮度

The new brightness to set the LED Bumper to from 0% to 100% as a whole number.

例子

当开始 :: hat events
[Build Used: Super Code Base 2.0]
[Light up the LED at different brightness levels.]
设定 [bumper v] 亮度为 [25]%
设定 [bumper v] 为 [绿色 v]
等待 [2] 秒
设定 [bumper v] 亮度为 [100]%

Bumper pressed#

The Bumper pressed Boolean block reports whether or not the LED Bumper is being pressed. This can be used to check if the robot bumps into other objects.

  • True — The LED Bumper is being pressed pressed.

  • False — The LED Bumper is not being pressed.

<[bumper v] 按下了?>

参数

描述

引领

要检查的选定 LED 保险杠在设备窗口中进行配置。

例子

当开始 :: hat events
[Build Used: Super Code Base 2.0]
[Turn right when the bumper is pressed.]
[左 v] 转
等到 <[bumper v] 按下了?>
[右 v] 转