User Manual
In this version of the code, we have rewritten the FRAME subroutine, using the DEPTH command
to automatically load frames from the stack until there are none left. This program uses 34 bytes to
store 31 frames, for an average of just 1.1 bytes per frame. We could store a sequence containing 900
different positions in the memory of the Micro Maestro using this kind of script.
Making smooth sequences with GET_MOVING_STATE
Speed and acceleration settings can be used to make smooth motion sequences with the Maestro.
However, a common problem is that you do not know how much you need to delay between frames
to allow the servo to reach its final position. Here is an example of how to use the built-in function
GET_MOVING_STATE to make a smooth sequence, instead of DELAY:
GET_MOVING_STATE returns a 1 as long as there is at least one servo that is limited by a speed or
acceleration setting still moving, so you can use it whenever you want to wait for all motion to stop
before proceeding to the next step of a script.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Moves servo in a sine wave between 1 and 2 ms.
begin
60 64 68 71 74 77 79 80 80 79 78 76 73 70 66 62
58 54 50 47 44 42 41 40 40 41 43 46 49 52 56
all_frames
repeat
sub all_frames
begin
depth
while
100 times
0 servo
100 delay
repeat
return
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# This example uses speed and acceleration to make a smooth
# motion back and forth between 1 and 2 ms.
3 0 acceleration
30 0 speed
begin
4000 0 servo # set servo 0 to 1.00 ms
moving_wait
8000 0 servo # 2.00 ms
moving_wait
repeat
sub moving_wait
begin
get_moving_state
while
# wait until it is no longer moving
repeat
return
?
?
Pololu Maestro Servo Controller User’s Guide © 2001–2019 Pololu Corporation
6. The Maestro Scripting Language Page 81 of 102










