引领#
介绍#
VEX AIM 编码机器人配备可编程 LED(发光二极管),可根据项目情况改变颜色。这些 LED 可以单独设置,也可以同时设置,以提供视觉反馈或指示机器人状态。
LED名称:
|
|
|
|---|---|---|
|
|
|
|
行动#
on#
on sets the color of one or all of the robot’s LEDs.
Usage:
robot.led.on(led, color)
范围 |
描述 |
|---|---|
|
The LED or LEDs to turn on. You can use a single LED like |
|
Optional. Sets the LED color. Options include:
|
# 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 turns off one or all of the robot’s LEDs.
Usage:
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))






