//ssctest.c: serial servo control using Scott Edwards mini SSC
// Note: servo range is expressed as 0 - 255 but can't actually
//       move through whole range.  115 is centered.  231 max.
// This demo assumes a 4 legged robot using two servos:
// Front servo on SSC connector #0, rear on #7

main()
{
int stepsize, numsteps, stepnum;
int turn;

stepsize = 30;
turn = (int)gets("Turn Angle? ");
numsteps = (int)gets("Number of Steps? ");

seropen(9600,"8N1X",1);  // talk to SSC

for (stepnum=0;stepnum < numsteps; stepnum++)
 {
 sersend(255); // SSC card attention
 sersend(0);   // Front servo
 sersend(115 + turn + stepsize);

 sersend(255);
 sersend(7);   // rear servo
 sersend(115 - turn - stepsize);

 // toggle to mirror commands for 2nd step
 stepsize = -1 * stepsize;

 sleep(400); // give servos time to move

 } // for stepnum

serclose();
} // main
 

Note: in the line " sersend(115 - turn - stepsize); " you can change the
first negative sign to a positive and cause an interesting crab-walk
gait.