LED#

Introduction#

The VEX AIM Coding Robot features programmable LEDs (Light-Emitting Diodes) that can change color based on conditions in a project. These LEDs can be set individually or all at once to provide visual feedback or indicate robot status.

LED Names:

A top down icon of the robot with a fan emerging from the location of the LED at the 11 o’clock position.
LED1

A top down icon of the robot with a fan emerging from the location of the LED at the 9 o’clock position.
LED2

A top down icon of the robot with a fan emerging from the location of the LED at the 7 o’clock position.
LED3

A top down icon of the robot with a fan emerging from the location of the LED at the 5 o’clock position.
LED4

A top down icon of the robot with a fan emerging from the location of the LED at the 3 o’clock position.
LED5

A top down icon of the robot with a fan emerging from the location of the LED at the 1 o’clock position.
LED6

A top down icon of the robot with fans emerging from the location of all six LEDs, clockwise at 1, 3, 5, 7, 9 and 11 o’clock positions.
ALL_LEDS

  • on – Turns one or all LEDs on and sets their color.

  • off – Turns one or all LEDs off.

Actions#

on#

on sets the color of one or all of the robot’s LEDs.

Usage:
robot.led.on(led, color)

Parameter

Description

led

The LED or LEDs to turn on. You can use a single LED like LED1, all LEDs with ALL_LEDS, or a group of LEDs in a tuple like (LED1, LED2). See all available LED names [here].(#introduction).

color

Optional. Sets the LED color. Options include:

  • BLACK
  • BLUE
  • CYAN
  • GREEN
  • ORANGE
  • PURPLE
  • RED
  • TRANSPARENT
  • WHITE (default)
  • YELLOW
You can also specify a custom color.

# 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)

Parameters

Description

led

The LED or LEDs to turn off. You can use a single LED like LED1, all LEDs with ALL_LEDS, or a group of LEDs in a tuple like (LED1, LED2). See all available LED names [here].(#introduction).

# 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))