Skip to contentSkip to Content
Language guideLED commands

LED commands

Mantis’s single onboard status LED is fully scriptable — there’s no fixed meaning attached to it, only what your script tells it to do:

CommandBehavior
LED_ONTurns the onboard LED on.
LED_OFFTurns the onboard LED off.

Combine both with DELAY to build a blink pattern, e.g. to signal that a script is about to finish:

blink.mantis
1REM Simple blink pattern
2LED_ON
3DELAY 300
4LED_OFF
5DELAY 300

Custom indications

You can combine LED commands with loops and conditional logic to create custom indicators. For example, you can blink the LED rapidly to tell the user that the script is paused and waiting for a physical button press before continuing.

wait_for_button.mantis
1REM Set typing speed for when we resume
2SET_SPEED $Human
3
4REM Loop infinitely until the button is pressed
5LOOP
6 REM Create a rapid blink pattern
7 LED_ON
8 DELAY 100
9 LED_OFF
10 DELAY 100
11
12 REM Check if the user has pressed the button
13 IF BUTTON_PRESSED THEN
14 REM Exit the loop and continue the script
15 BREAK
16 END_IF
17END_LOOP
18
19REM The script only reaches here once the button is pressed
20STRINGLN The button was pressed. Resuming execution!

See the LEDs hardware page for the LED itself.

Last updated on