User Manual

Note that we use 0 to set the output low and 8000 to set the output high. These are reasonable
choices, but any value from 0 to 5999 could be used for low, and anything from 6000 to 32767 could
be used for high, if desired.
Serial output (Mini Maestro 12, 18, and 24 only)
On the Mini Maestro 12, 18, and 24, a script can be used to send serial data out on the TTL-level serial
port (TX). This means that the Maestro can control additional Maestros, allowing for large numbers
of channels without a separate microcontroller. Here is a simple program that shows how a serial
command can be used to control another Maestro. To use this code, configure both Maestros in UART
mode at the same baud rate, and connect TX on the master to RX on the slave.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
begin
1023 0 0 rgb 500 delay # red
0 1023 0 rgb 500 delay # green
0 0 1023 rgb 500 delay # blue
repeat
# Subroutine for setting the RGB value of a ShiftBrite/ShiftBar.
# example usage: 1023 511 255 rgb
sub rgb
0 send_bit # this bit does not matter
0 send_bit # the "address" bit - 0 means a color command
swap rot rot
send_10_bit_value
send_10_bit_value
send_10_bit_value
0 1 8000 1 servo servo # toggle the latch pin
return
# sends a numerical value as a sequence of 10 bits
sub send_10_bit_value
512
begin
dup
while
over over bitwise_and send_bit
1 shift_right
repeat
drop drop
return
# sends a single bit
sub send_bit
if 8000 else 0 endif
2 servo # set DATA to 0 or 1
0 0 8000 0 servo servo # toggle CLOCK
return
?
Pololu Maestro Servo Controller User’s Guide © 2001–2019 Pololu Corporation
6. The Maestro Scripting Language Page 88 of 102