引领#
介绍#
VEX AIM 编程机器人机身周围有六个 LED(发光二极管)。这些 LED 可以设置为不同的颜色,用于提供反馈、显示机器人状态,或使项目过程中更容易追踪机器人。
每个 LED 都可以单独设置,所有 LED 可以同时设置,或者可以使用元组将一组 LED 一起设置。
LED名称:
|
|
|
|---|---|---|
|
|
|
|
以下是所有方法的列表:
操作——打开或关闭 LED 灯。
行动#
on#
on turns on one LED, all LEDs, or a group of LEDs.
Usage:
robot.led.on(led, color)
范围 |
描述 |
|---|---|
|
The LED or LEDs to turn on:
|
|
Optional. The color to set the selected LED or LEDs to:
|
示例
# Turn all LEDs green while the screen is pressed
while True:
if robot.screen.pressing():
robot.led.on(ALL_LEDS, GREEN)
else:
robot.led.off(ALL_LEDS)
wait(50, MSEC)
# Turn two LEDs red
robot.led.on((LED3, LED4), RED)
off#
off turns off one LED, all LEDs, or a group of LEDs.
Usage:
robot.led.off(led)
范围 |
描述 |
|---|---|
|
The LED or LEDs to turn off:
|
示例
# Turn all LEDs on for 2 seconds, then turn them off
robot.led.on(ALL_LEDS)
wait(2, SECONDS)
robot.led.off(ALL_LEDS)
# Turn off half of the LEDs
robot.led.on(ALL_LEDS)
wait(1, SECONDS)
robot.led.off((LED3, LED4, LED5))






