引领#
介绍#
VEX AIM 编码机器人配备可编程 LED(发光二极管),可根据项目情况改变颜色。这些 LED 可以单独设置,也可以同时设置,以提供视觉反馈或指示机器人状态。
LED名称:
|
|
|
---|---|---|
|
|
|
|
行动#
on#
on
设置机器人的一个或所有 LED 的颜色。
用法:
robot.led.on(led, color)
范围 |
描述 |
---|---|
|
The LED or LEDs to turn on. You can use a single LED like |
|
可选。设置 LED 颜色。选项包括:
|
# Turn LEDs green while the screen is pressed
while True:
if robot.screen.pressing():
robot.led.on(ALL_LEDS, GREEN)
else:
robot.led.on(ALL_LEDS, BLACK)
wait(50, MSEC)
# Turn two LEDs red
robot.led.on((LED3, LED4), RED)
off#
off
关闭机器人的一个或所有 LED。
用法:
robot.led.off(led)
参数 |
描述 |
---|---|
|
The LED or LEDs to turn off. You can use a single LED like |
# Turn the LEDs on for 2 seconds.
robot.led.on(ALL_LEDS)
wait(2, SECONDS)
robot.led.off(ALL_LEDS)
# Turn off half the LEDs
robot.led.on(ALL_LEDS)
wait(1, SECONDS)
robot.led.off((LED3, LED4, LED5))