Skip to contentSkip to Content
The Language of MantisSystem & device commands

System & device commands

Both of these commands are wired to the physical Upload button on H1.

WAIT_FOR_BUTTON_PRESS

Halts the entire script until the physical Upload button on H1 is pressed, then continues:

wait.hdc
STRING waiting for user input... WAIT_FOR_BUTTON_PRESS STRINGLN Continuing after the press.

BUTTON_DEF … END_BUTTON

Defines a handler block that runs whenever the button is pressed while the rest of the script is executing. The main script pauses at the next safe point, the handler runs, and then the main script picks back up exactly where it left off:

button-def.hdc
BUTTON_DEF STRING You pressed the button! ENTER END_BUTTON STRING This types at boot... DELAY 5000 STRING ...and the button works the whole time.
  • Only one BUTTON_DEF is allowed per script.
  • A BUTTON_DEF can’t be defined inside a FUNCTION, and a FUNCTION can’t be defined inside a BUTTON_DEF — but the handler body can call functions defined elsewhere.
  • If a WAIT_FOR_BUTTON_PRESS is actively waiting when the button is pressed, that wait is satisfied first — the handler does not also fire for that same press.

Once the main script finishes, if it defined a BUTTON_DEF, H1 stays resident and keeps running the handler on every subsequent press for as long as it’s plugged in.

Last updated on