Ssc-32 Servo Control Via Script

 
#1

Someone on the forum contacted me via email and wanted a sample script of how to control the Lynxmotion ssc-32 servo board via a script.... I am posting it here in case anyone else might be interested...

FYI ... EZ Builder now has an SSC-32 control which is also supported in the auto-positioner....

Code:


#This is an example of controlling servos on the ssc-32 servo board via scripts
#However you can now use the auto positioner if you wish to make it easier
#It assumes you have set the SSC-32 for 38,400 baud
#It is connected to URAT port 0 with ground and TX on the EZB
#On the SSC-32 you connect to ground and Rx

UARTInit(0,0,38400) #initialize the ssc-32 on UART port 0, call only once
sleep(1000)

#This will move 5 servos to centre position (90)

$pw = "1500" #1500 = 90, 500~ min and 2500~ max for 1 to 180...
$m = "1000" #is speed control


UARTWrite(0,0,"#1P"+$pw+"S"+$m,13) #right index on port 1
UARTWrite(0,0,"#2P"+$pw+"S"+$m,13) #right middle on port 2
UARTWrite(0,0,"#3P"+$pw+"S"+$m,13) #right ring on port 3
UARTWrite(0,0,"#4P"+$pw+"S"+$m,13) #right baby on port 4

sleep(500)
UARTWrite(0,0,"#0P"+$pw+"S"+$m,13) #right thumb on port 0

#2

And it's also supported using Servo() command. Just use the Vx servo ports. Smile

#3

Even easier. ... thanks @DJ Smile