I’m new to VCS, and this might be a pretty basic question, but I was wondering how I could stop a task. Right now, I have something that looks like this:
int capdrive()
{
Leftdrivefront.spin(vex::directionType::fwd, Controller.Axis3.value(), vex::velocityUnits::pct);
Leftdriveback.spin(vex::directionType::fwd, Controller.Axis3.value(), vex::velocityUnits::pct);
Rightdrivefront.spin(vex::directionType::fwd, Controller.Axis2.value(), vex::velocityUnits::pct);
Rightdriveback.spin(vex::directionType::fwd, Controller.Axis2.value(), vex::velocityUnits::pct);
}
int main()
{
while(1)
{
vex::task drive(balldrive);
if(Controller.ButtonR2.pressing())
{
drive.stop();
Rightdriveback.stop(vex::brakeType::hold);
Rightdrivefront.stop(vex::brakeType::hold);
Leftdriveback.stop(vex::brakeType::hold);
Leftdrivefront.stop(vex::brakeType::hold);
}
}
}
The problem that I’m having is that the drive task won’t really stop, and since the drive code hasn’t stopped, the motors aren’t holding. How would I solve this?