Is there a reason why you are stating velocityUnits::pct twice? I’m not a skilled programmer so I don’t know but that could be your problem.
If it’s not why not just use like LeftFrontDrive.spin(directionType::fwd,127,velocityUnits::pct)
or something like that then wait 2.5 secs with task::sleep(2500)
then just stop the motor with LeftFrontDrive.stop(brakeType::brake)
or however you want to stop.
This would go outside of any loops, like any other function would.
int taskName()
while(1) {
/*Task stuff in here, for example a button if pressed loop*/
vex::this_thread::sleep_for(25); /*prevent wasted resources*/
}
return(0);
}
You then put this in the driver loop(if you want to use during driver)
I am unfortunately old school and don’t know anything about V5 or VEX C++ so I can’t really help but in general whatever it is you want to do while the motor is running should go in another task. Tasks are scheduled in the blocks of time when other tasks are blocked by the framework.
Tasks are not really ANSI C, they’re added for VEX hardware in ROBOTC, PROS, VCS, whatever. It’s part of the API and you’ll need to learn the specifics and the semantics.
You are adding a second velocityunits , which is unnecessary and throws syntax errors. LeftFrontDrive.rotateFor(2.5,vex::timeUnits:sec,50,velocityUnits::pct) should be all you need. The false is not needed since the motor defaults to forward when a Boolean is not supplied.