User Manual

Then, whenever you want send these two servos back to neutral, you can just use “neutral” as a
command. More advanced subroutines take values off of the stack. For example, the subroutine
will set channel 2 to the value on the top of the stack and channel 1 to the next value. So, if you write
“4000 6000 set_servos”, your script will set channel 1 to 4000 and channel 2 to 6000.
Subroutines can call other subroutines, up to a limit of 10 levels of recursion. For example, the
subroutine “neutral” above can be implemented by calling set_servos:
6.b. Command Reference
The following is the entire list of commands and keywords in the Maestro script language. The “stack
effect” column specifies how many numbers are consumed and added to the stack. For example, the
PLUS command takes off two numbers and returns one; so it has a stack effect of -2,+1. Commands
with special effects will be marked with a *.
1
2
3
4
sub neutral
6000 1 servo
6000 2 servo
return
1
2
3
sub set_servos
2 servo 1 servo
return
1
2
3
sub neutral
6000 6000 set_servos
return
?
?
?
Pololu Maestro Servo Controller User’s Guide © 2001–2017 Pololu Corporation
6. The Maestro Scripting Language Page 70 of 99