User Manual

Stack commands
command
stack
effect
description
DEPTH +1 gets the number of numbers on the stack
DROP -1 removes the top number from the stack
DUP +1 duplicates the top number
OVER +1 duplicates the number directly below the top, copying it onto the top
PICK -1,+1
takes a number n between 0 and 63, then puts the nth number below the top
onto the stack (0 PICK is equivalent to DUP)
SWAP
a,b
b,a
swaps the top two numbers
ROT
a,b,c
b,c,a
permutes the top three numbers so that the 3rd becomes the top and the others
move down one position
ROLL -1,*
takes a number n, then permutes the top n+1 numbers so that the n+1th
becomes the top and all of the others move down one
PEEK -1,+1
(Mini Maestro 12, 18, and 24 only) takes a number n, then copies the nth
value on the stack (measured from the bottom) to the top of the stack
POKE -2,+1
(Mini Maestro 12, 18, and 24 only) takes a number n, then removes the next
value from the stack and puts it at the nth location on the stack (measured from
the bottom)
Mathematical commands (unary)
These commands take a single argument from the top of the stack, then return a single value as a
result. Some of these have equivalents in C (and most other languages), listed in the “C equivalent”
column below. We use “false” to mean 0 and “true” to mean any non-zero value. A command returning
“true” always returns a 1.
Pololu Maestro Servo Controller User’s Guide © 2001–2019 Pololu Corporation
6. The Maestro Scripting Language Page 74 of 102