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.