示例#1
0
/** makeBox **************************************************************
 * Makes the robot move in a 2'x2' square
 * ***********************************************************************/
void makeBox() {
	driveAhead(BOX_WIDTH);
	turnRight();
	driveAhead(BOX_WIDTH);
	turnRight();
	driveAhead(BOX_WIDTH);
	turnRight();
	driveAhead(BOX_WIDTH);
	turnRight();
}
/** This function waits for any of the three buttons to be pressed, and
 *  will respond differently to each of the three button presses.
 *  A will turn left
 *  B will drive ahead one foot, and
 *  C will turn right.
 */
void testMotion() {

	char button = waitForAnyButton();  // get the button that is pressed
	if (button == BUTTON_A) {  // and comparisons below

		turnLeft();
	}
	else if (button == BUTTON_B) {

		driveAhead(1.0);
	}
	else if (button == BUTTON_C) {

		turnRight();
	}
	else {

		print("what?");
	}
}