Skip to content

LED Rainbow

This example goes through a rainbow effect by gradually changing the LED colors. The loop runs indefinitely until the device is unplugged.

  • LOOP_BEGIN starts an infinite loop.
  • LED r g b sets the LED color using red, green, and blue values (0-255).
  • DELAY pauses execution for the specified number of milliseconds.
LOOP_BEGIN
# --- RED to YELLOW ---
LED 255 0 0
DELAY 100
LED 255 32 0
DELAY 100
LED 255 64 0
DELAY 100
LED 255 96 0
DELAY 100
LED 255 128 0
DELAY 100
LED 255 160 0
DELAY 100
LED 255 192 0
DELAY 100
LED 255 224 0
DELAY 100
LED 255 255 0
DELAY 100
# --- YELLOW to GREEN ---
LED 192 255 0
DELAY 100
LED 128 255 0
DELAY 100
LED 64 255 0
DELAY 100
LED 0 255 0
DELAY 100
# --- GREEN to CYAN ---
LED 0 255 32
DELAY 100
LED 0 255 64
DELAY 100
LED 0 255 96
DELAY 100
LED 0 255 128
DELAY 100
LED 0 255 160
DELAY 100
LED 0 255 192
DELAY 100
LED 0 255 224
DELAY 100
LED 0 255 255
DELAY 100
# --- CYAN to BLUE ---
LED 0 224 255
DELAY 100
LED 0 192 255
DELAY 100
LED 0 160 255
DELAY 100
LED 0 128 255
DELAY 100
LED 0 96 255
DELAY 100
LED 0 64 255
DELAY 100
LED 0 32 255
DELAY 100
LED 0 0 255
DELAY 100
# --- BLUE to MAGENTA ---
LED 32 0 255
DELAY 100
LED 64 0 255
DELAY 100
LED 96 0 255
DELAY 100
LED 128 0 255
DELAY 100
LED 160 0 255
DELAY 100
LED 192 0 255
DELAY 100
LED 224 0 255
DELAY 100
LED 255 0 255
DELAY 100
# --- MAGENTA to RED ---
LED 255 0 224
DELAY 100
LED 255 0 192
DELAY 100
LED 255 0 160
DELAY 100
LED 255 0 128
DELAY 100
LED 255 0 96
DELAY 100
LED 255 0 64
DELAY 100
LED 255 0 32
DELAY 100
LED 255 0 0
DELAY 100
# --- LOOP BACK ---
LOOP_END