LED#

Introduction#

The VEX AIM Coding Robot has six LEDs (Light-Emitting Diodes) around the body of the robot. The LEDs can be set to different colors to give feedback, show a robot status, or make the robot easier to track during a project.

Each LED can be set individually, all LEDs can be set at the same time, or a group of LEDs can be set together using a tuple.

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 all six LED locations.
ALL_LEDS

Below is a list of all methods:

Actions — Turn LEDs on or off.

  • on — Turns on one LED, all LEDs, or a group of LEDs.

  • off — Turns off one LED, all LEDs, or a group of LEDs.

Actions#

on#

on turns on one LED, all LEDs, or a group of LEDs.

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

Parameter

Description

led

The LED or LEDs to turn on:

  • A single LED, such as LED1
  • All LEDs with ALL_LEDS
  • A group of LEDs in a tuple, such as (LED1, LED2)

color

Optional. The color to set the selected LED or LEDs to:

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

Examples

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

Parameter

Description

led

The LED or LEDs to turn off:

  • A single LED, such as LED1
  • All LEDs with ALL_LEDS
  • A group of LEDs in a tuple, such as (LED1, LED2)

Examples

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