Skip to content

Single-color LED

The official Raspberry Pi Pico board has a built-in single-color LED that can only be turned on or off. You can control the LED with the led command in pico-jxglib's shell.

Control the LED

To turn the LED on and off:

L:/>led on
L:/>led off

Use the flip subcommand to toggle the LED at specified intervals. The following example blinks the LED every 100ms:

L:/>led on flip:100

The flip subcommand blinks the LED eternally in the background, so you can run other commands while the LED blinks. To stop the blinking, use the led off command:

L:/>led off

The following example blinks the LED for 50ms, off for 500ms, three times, then off for 2000ms, and repeats:

L:/>led on flip:50,500,50,500,50,2000

To stop flipping after a certain number of times, add * at the end. The following blinks three times, then turns off:

L:/>led on flip:50,500,50,500,50,*

Command Reference

led

Help of the Command
Usage: led [OPTION]... CMDS...
Options:
 -h --help prints this help
Sub Commands:
 on          turn on LED
 off         turn off LED
 flip:MS...  start blinking LED with specified durations (in msec)
             e.g. flip:500,500 (500 msec ON, 500 msec OFF)
             specifies * to end the blinking (eg. flip:100,500,100,*)