Having 2 functions work at the same time during auto

Hi there,

So I tried using functions in auton and using the “false” command at the end but it wasnt working, both functions ran separately, gives me an expression result unused:

void autonomous(void) {



So i’m trying to do two things in one function, but I am not sure if I did it right…

void drivArm(int distance, int speed, directionType direction, int degrees, int speed2){


  robotDrive.driveFor(direction, distance, distanceUnits::in, speed, velocityUnits::pct);
  ArmsTog.rotateFor(degrees, rotationUnits::deg, speed2, velocityUnits::pct);




If need the whole code just to see, lmk, I can post it.

You can only use the "false command" (which, for further reference, is an optional parameter) with VEX API functions (for example, directly running spin on a motor.) This means it won’t work on any functions you make yourself. The syntax you use is also wrong: you are supposed to pass in the “false” as a parameter. For example, if you wanted to spin two motors at the same time, you could do something like:

intake.spinFor(500, msec, 100, velocityUnits::pct, false);
// do not need "false" on the second command because it is the last command in the sequence
lift.spinFor(500, msec, 50, velocityUnits::pct); 

As for your second example, what you are doing is driving your robot forward, rotating your arm motor, and doing that over and over again until the program exits. What you should be able to do is remove the lines that start and end the while loop (so, the while(1){ and the } that follows a few lines later), then just add a false as the last parameter of your driveFor call. This should drive your robot and rotate your arm motor at the same time, then stop the function when your arm motor stops spinning.

If you need any further help, please let me know and I will be glad to assist!

– Michael, 8349P


i asked a similar question to this, and here is the solution