Papke, Kevin
Page Navigation
- Welcome
- Period 1 - Advanced Robotics
- Period 3/4 - Design/Robotics
- Period 5 - Exploratory
- Period 6 - Technology
- Expectations
- Catapult contest - History Faire
- Pictures of my classroom
- Robotics Class Video
- Technology links
- Robot-C Programming
- Interesting Stuff
- Ocean Institute
- Fidget spinner
- 15 reasons dogs are better than cats
- Why cats are better than dogs
- Veteran's Day Webquest
- Cinco de Mayo
- PLTW Summit - Onshape Presentation
- Mechanical Power-trains
-
Moving back and forth
This simple program allows your robot to go forward a specific distance and then go backward and return to it’s starting spot. You program your robot to go a specific number of degrees and then you know exactly how far it will
task main()
{
//Reset the motorEncoders
SensorValue(rightEncoder) = 0;
SensorValue(leftEncoder) = 0;
wait1Msec(100); //short pause to reduce jerky motor movement//set the encoder target
//for 5 rotations, we want to rotate 5 * 1800 degreeswhile(SensorValue[rightEncoder] < 1800)
{
//start both motors at half speed
startMotor(rightMotor, 63);
startMotor(leftMotor, 63);
}//stop both motors
stopMotor(rightMotor);
stopMotor(leftMotor);
wait1Msec(2000); //pause for 2 seconds
{//reset both motor Encoders to zero
SensorValue(rightEncoder) = 0;
SensorValue(leftEncoder) = 0;
wait1Msec(100); //pause .5 second to reduce jerky motor movement//for 5 rotations, we want to rotate 5 * 1800 degrees
while(SensorValue(rightEncoder) > -1800)
{
startMotor(rightMotor, -60);
startMotor(leftMotor, -60);
}
{
//stop both motors
stopMotor(rightMotor);
stopMotor(leftMotor);
}
}
}