You have two options to make it work:
- Turn task autonomous into a while loop and use timer to determine when to do a specific task
- Create a second task and make autonomous turn on the task and manipulate values within the task.
Number 2 is easy to do in VCS, but since I haven’t went in VCS for a while have a bit of mercy:
int catapultDown(){
while(true){
if(CatapultPotentiometer.value(analogUnits::range12bit) < 850) {
CatapultMotor.spin(vex::directionType::fwd, 100, vex::velocityUnits::pct);
}
else {
CatapultMotor.stop(brakeType::hold);
}
}
}
void autonomous(){
// this is similar to startTask
vex::thread t(catapultDown);
}