Whats wrong with this code??? Its a puncher code and what I want it to do is when I press Button X, the puncher motors turn 270 degrees and shoots and stops.
int puncher(int)
{
while(true)
{
Punchermotor1.startRotateTo(270,vex::rotationUnits::deg,100,vex::velocityUnits::pct);
Punchermotor2.startRotateTo(270,vex::rotationUnits::deg,100,vex::velocityUnits::pct);
Punchermotor1.stop(vex::brakeType::brake);
Punchermotor2.stop(vex::brakeType::brake);
}
}
void usercontrol( void ) {
// User control code here, inside the loop
while (1)
{
// This is the main execution loop for the user control program.
// Each time through the loop your program should update motor + servo
// values based on feedback from the joysticks.
// ........................................................................
// Insert user code here. This is where you use the joystick values to
// update your motors, etc.
// ........................................................................
if(Controller.ButtonX.pressed(int (puncher(int)));
}
}
And second question: What is the difference between “rotateTo”, “startrotateTo”, “RotateFor” and “startRotateFor”?
Last question (I swear): Are there any sample codes (not the ones on VCS) that I can see to understand VCS and C++? It is very challenging for me to code in VCS and am struggling very hard.
Desperately thanks,
2979E.