Using the Pololu Servo Controller with the BASIC Stamp 2

Using the Pololu Servo Controller with the BASIC Stamp 2
Using the Pololu Servo Controller with the BASIC Stamp 2
To use the Pololu servo controller with the BASIC Stamp 2, use the “serout” command. The command has
several options that are explained in the BASIC Stamp manual, but only the pin, baudmode, and output data
need to be specified for use with the servo controller.
In the Pololu mode example below, servo 0 is set to its lowest speed, and then servo 0 and 1 are moved back
and forth with 10 second pauses to show the difference in speeds. In the example, the servo controller serial
line is connected to I/O pin 15 of the BASIC Stamp. The second argument sets the baud rate to 9600 and sets
other parameters to 8 bits, no parity, and non-inverted mode. The arguments in the square brackets are the
values actually sent over the serial line. The sync byte, $80 (the $ sign indicates hex; you could also write 128),
and the second byte, $01, are always necessary for controlling the servo controller. The third byte is the
command, where 1 is the set speed command and 4 is the set absolute position command. The last value (or 2
values) is the argument for the command. The ‘1’ in the first line sets the speed to 1. The 13 and 127 set the
position to (13*128 + 127) = 1791, which corresponds to output pulses of about 0.9 ms.
In mini SSC II mode (with jumper in place), the commands all take the form,
serout 15, 84, [255, <servo-num>, <servo-pos>]
where <servo-num> is the servo number, from 0-15, and <servo-pos> is the servo position, from 0-254.
Command number:
(01 is set speed)
Serial settings
396: 2400 baud
84: 9600 baud
6: 38400 baud
Required header
for SSC01A
Servo number
for command
Data value
for command
BS2 pin to use
for serial out
serout 15,84,[$80,$01,$01,0,1]
'set servo 0 to lowest speed
serout 15,84,[$80,$01,$04,0,13,127]
serout 15,84,[$80,$01,$04,1,13,127]
pause 10000
serout 15,84,[$80,$01,$04,0,35,127]
serout 15,84,[$80,$01,$04,1,35,127]
pause 10000
goto testloop
© 2002
'set pos servo 0
'set pos servo 1
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF