LED保险杠#

介绍#

LED 保险杠可以改变其 LED 的颜色并检测何时被按下。

For the examples below, the configured LED Bumper will be named ledbumper_1. They will be used in all subsequent examples throughout this API documentation when referring to LEDBumper class methods.

以下是所有方法的列表:

改变器——改变颜色和亮度。

Getters – 从 LED 保险杠返回数据。

  • is_pressed – 返回 LED 保险杠是否被按下。

修改器#

set_color#

set_color sets the color of the LED Bumper. If the LED is not already on when this method is used, it will set the brightness to 100% to turn the LED on.

Usage:
ledbumper_1.set_color(color)

参数

描述

color

The color to set the LED Bumper to:

  • GREEN
  • OFF
  • RED
# Example coming soon

set_brightness#

set_brightness sets the brightness of the LED Bumper.

Usage:
ledbumper_1.set_brightness(color)

参数

描述

color

LED 的亮度以百分比表示,范围从 0% 到 100%。

# Example coming soon

盖特#

is_pressed#

pressed returns a Boolean indicating whether or not the LED Bumper is pressed.

  • True – The bumper was pressed.

  • False – The bumper was not pressed.

Usage:
ledbumper_1.is_pressed()

参数

描述

该方法没有参数。

# Example coming soon