src/main.cpp
/**
 * Runs the operator control code. This function will be started in its own task
 * with the default priority and stack size whenever the robot is enabled via
 * the Field Management System or the VEX Competition Switch in the operator
 * control mode.
 *
 * If no competition control is connected, this function will run immediately
 * following initialize().
 *
 * If the robot is disabled or communications is lost, the
 * operator control task will be stopped. Re-enabling the robot will restart the
 * task, not resume it from where it left off.
 */
Runs the operator control code. This function will be started in its own task
with the default priority and stack size whenever the robot is enabled via
the Field Management System or the VEX Competition Switch in the operator
control mode.

If no competition control is connected, this function will run immediately
following initialize().

If the robot is disabled or communications is lost, the
operator control task will be stopped. Re-enabling the robot will restart the
task, not resume it from where it left off.
Runs the operator control code . This function will be started in its own task with the default priority and stack size whenever the robot is enabled via the Field Management System or the VEX Competition Switch in the operator control mode . If no competition control is connected this function will run immediately following initialize () . If the robot is disabled or communications is lost the operator control task will be stopped . Re - enabling the robot will restart the task not resume it from where it left off .
void opcontrol() {
	Controller master(master);
	ControllerButton buttonA(ControllerDigital::A);
	ControllerButton buttonB(ControllerDigital::B);
	ControllerButton buttonX(ControllerDigital::X);
	ControllerButton buttonY(ControllerDigital::Y);
	ControllerButton buttonLB(ControllerDigital::L1);
	ControllerButton buttonLT(ControllerDigital::L2);
	ControllerButton buttonRB(ControllerDigital::R1);
	ControllerButton buttonRT(ControllerDigital::R2);
	int goalHeight = 0;
	while(true) {
		drivetrain::tankDrive(master.getAnalog(ControllerAnalog::leftY),
						 	  master.getAnalog(ControllerAnalog::rightY));
		if(buttonLT.isPressed()) {
			intake::intakeIn(12000);
		}
		else if(buttonRT.isPressed()) {
			intake::intakeOut(12000);
		}
		else {
			intake::stopIntake();
		}
		if(buttonA.isPressed()) {
			wrist::wristUp(12000);
		}
		else if(buttonB.isPressed()) {
			wrist::wristDown(12000);
		}
		else {
			wrist::stopWrist();
		}
		if (buttonX.changedToPressed() && goalHeight < numHeights - 1) {
			goalHeight++;
			wrist::wristToPosition(height[goalHeight]);
		}
		else if (buttonY.changedToPressed() && goalHeight > 0) {
			goalHeight--;
			wrist::wristToPosition(height[goalHeight]);
		}
		if (buttonLB.isPressed()) {
			pusher::pusherForward(4000);
		}
		else if (buttonRB.isPressed()) {
			pusher::pusherBackward(4000);
		}
		else {
			pusher::stopPusher();
		}
		pros::delay(20);
	}
}
void opcontrol ( ) { Controller master ( master ) ; ControllerButton buttonA ( ControllerDigital :: A ) ; ControllerButton buttonB ( ControllerDigital :: B ) ; ControllerButton buttonX ( ControllerDigital :: X ) ; ControllerButton buttonY ( ControllerDigital :: Y ) ; ControllerButton buttonLB ( ControllerDigital :: L1 ) ; ControllerButton buttonLT ( ControllerDigital :: L2 ) ; ControllerButton buttonRB ( ControllerDigital :: R1 ) ; ControllerButton buttonRT ( ControllerDigital :: R2 ) ; int goalHeight = 0 ; while ( true ) { drivetrain :: tankDrive ( master . getAnalog ( ControllerAnalog :: leftY ) , master . getAnalog ( ControllerAnalog :: rightY ) ) ; if ( buttonLT . isPressed ( ) ) { intake :: intakeIn ( 12000 ) ; } else if ( buttonRT . isPressed ( ) ) { intake :: intakeOut ( 12000 ) ; } else { intake :: stopIntake ( ) ; } if ( buttonA . isPressed ( ) ) { wrist :: wristUp ( 12000 ) ; } else if ( buttonB . isPressed ( ) ) { wrist :: wristDown ( 12000 ) ; } else { wrist :: stopWrist ( ) ; } if ( buttonX . changedToPressed ( ) && goalHeight < numHeights - 1 ) { goalHeight ++ ; wrist :: wristToPosition ( height [ goalHeight ] ) ; } else if ( buttonY . changedToPressed ( ) && goalHeight > 0 ) { goalHeight -- ; wrist :: wristToPosition ( height [ goalHeight ] ) ; } if ( buttonLB . isPressed ( ) ) { pusher :: pusherForward ( 4000 ) ; } else if ( buttonRB . isPressed ( ) ) { pusher :: pusherBackward ( 4000 ) ; } else { pusher :: stopPusher ( ) ; } pros :: delay ( 20 ) ; } }
Runs the operator control code.
Runs the operator control code .
// initalizing all buttons // arcade drive controls // drivetrain::arcadeDrive(master.getAnalog(ControllerAnalog::leftY), // 						master.getAnalog(ControllerAnalog::rightX)); // tank drive controls // controls // wait and give unnecessary time to other tasks // motor telemetry, joystick values, etc. update every 10ms