Programming instructions
Reference
Project Lead The Way
©
and Carnegie Mellon Robotics Academy
©
/ For use with VEX
®
Robotics Systems
Servo Motors • 2
motor[port6] = -127; //Set position fully backward
wait1Msec(1000); //Wait for 1 second
motor[port6] = -95; //Set position 3/4 backward
wait1Msec(1000); //Wait for 1 second
motor[port6] = -63; //Set position 1/2 backward
wait1Msec(1000); //Wait for 1 second
motor[port6] = -31; //Set position 1/4 backward
wait1Msec(1000); //Wait for 1 second
motor[port6] = 0; //Set position to middle
wait1Msec(1000); //Wait for 1 second
motor[port6] = 31; //Set position 1/4 forward
wait1Msec(1000); //Wait for 1 second
motor[port6] = 63; //Set position 1/2 forward
wait1Msec(1000); //Wait for 1 second
motor[port6] = 95; //Set position 3/4 forward
wait1Msec(1000); //Wait for 1 second
motor[port6] = 127; //Set position fully forward
wait1Msec(1000); //Wait for 1 second
Servo Motors Sample Code
Rotating the Servo Modules Shaft to Different Positions
This code rotates a Servo Module on MOTOR Port 6 to a different position every second,
starting at -127 (fully backward) and ending at 127 (fully forward).
Go to Reference Links