User Manual

Whenever connecting devices, remember to wire the grounds together, and ensure that
each device is properly powered. Unpowered devices with a TTL serial port can turn on
or partially on, drawing power from the serial line, which means that extra care must be
taken when turning power off and on to reset the devices.
Sending commands
The Pololu Protocol or Mini SSC protocol should be used when multiple Pololu devices are receiving
the same serial data. This allows the devices to be individually addressed, and it allows responses to
be sent without collisions.
If the devices are configured to detect the baud rate, then when you issue your first Pololu Protocol
command, the devices can automatically detect the baud from the initial 0xAA byte.
Some older Pololu devices use 0x80 as an initial command byte. If you want to chain these together
with devices expecting 0xAA, you should first transmit the byte 0x80 so that these devices can
automatically detect the baud rate, and only then should you send the byte 0xAA so that the Maestro
can detect the baud rate. Once all devices have detected the baud rate, Pololu devices that expect a
leading command byte of 0x80 will ignore command packets that start with 0xAA, and the Maestro will
ignore command packets that start with 0x80.
5.h. Serial Example Code
5.h.1. Cross-platform C
The example C code below works on Windows, Linux, and Mac OS X 10.7 or later. It demonstrates
how to set the target of a Maestro channel by sending a Set Target command to its Command Port,
and how to read the position of a channel by sending the Get Position command. The Maestro’s serial
mode needs to be set to “USB Dual Port” for this code to work. You will also need to modify the line
that specifies the name of the COM port device.
This code will work in Windows if compiled with MinGW, but it does not work with
the Microsoft C compiler. For Windows-specific example code that works with either
compiler, see Section 5.h.2.
Pololu Maestro Servo Controller User’s Guide © 2001–2017 Pololu Corporation
5. Serial Interface Page 61 of 99