For anyone who’s interested I’ve put together a simple test program for anyone using Python as it seems to be an excellent and quick way to get projects done. I find I write a lot of short programs for general purpose (fun) projects that get recycled after a week, so it is great for that.
It wouldn’t take much to get this running under Windows, if you must.
Here it is. Feel free to post questions if you have issues on it:
#BEGIN-----------------------------------------------------------------------
# Python serial servo tester for Pololu USB 16 servo controller
# Author: Jim Munro <jimmn_1999<at>yahoo<dot>com>
# Simple test program to test your controller works under linux
# tested and worked under Ubuntu Linux 'Feisty'
#
# Note: this is testing the controller under the SSC mode and not
# the special Pololu mode. The benefit, is that it's much easier to
# when getting started, the down side is that you lose some of the
# advanced functionality provided. It should be trivial to modify
# this to handle the appropriate strings once you get this working.
# Prerequisites:
# Python installed (tested with 2.5)
# PySerial installed (ver 2.2) 'http://pyserial.sourceforge.net/'
# Your serial controller is plugged in to your USB port
# should be autodetected and device created under /dev/ttyUSB#
# where # is the device #. Likely will be ttyUSB0
# will need to change below if a number other than 0 is created.
import serial # import PySerial libraries
START_BYTE = '\xff'
#general purpose test function to write out the serial string
#on the serial port.
def ss(servo, pos):
servo_num = servo + 16 # note that the port is always n+16
s = '%c%c%c' % (START_BYTE, chr(servo_num), chr(pos))
ser.write(s)
print 'Moved Servo: %s to pos:%d' % (servo, pos)
ser = serial.Serial('/dev/ttyUSB0') # set up the serial port using the default device (see note above)
#a little servo exercise
for i in range(0,255):
ss(0,i) # only testing a single servo
#END----------------------------------------