User Manual
Connecting the Micro Maestro to a chain of
ShiftBars. A single 12V supply powers all of the
devices.
The digital output feature of the Maestro is
capable of controlling anything from simple
circuits to intelligent devices such as the
ShiftBrite LED Modules [https://www.pololu.com/
product/1222] and ShiftBar LED Controllers
[https://www.pololu.com/product/1242], which use a
simple synchronous serial protocol. In this
example, the clock, latch, and data pins of a
ShiftBrite or ShiftBar are connected to servo
channels 0, 1, and 2, respectively, and these
channels are all configured as outputs. The
subroutine RGB defined here takes 10-bit red,
green, and blue values from the stack, then sends a 32-byte color packet and toggles the latch pin to
update the ShiftBrite with the new color value. The subroutine could be modified to control a larger
chain of ShiftBrites if desired.
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–2017 Pololu Corporation
6. The Maestro Scripting Language Page 85 of 99










