Function help, are my numbers wrong? is it something to do with that is true/false

When autonomous is used, the variables seem to not move/ not follow one another. They do one action and all the other variables are skipped.
here is an example of a drive forward command and a turn right command
anytime they are called, they do not do anything.
we have a four motor drive train and want all the motors to work at the same time.

float degreesFWD = inchesFWD*35.277;
leftMotor1.spinFor(forward, degreesFWD, degrees, false);
rightMotor1.spinFor(forward, degreesFWD, degrees, false);
leftMotor2.spinFor(forward, degreesFWD, degrees);
rightMotor2.spinFor(forward, degreesFWD, degrees);
}
void turnRT(float inchesFWD){
float degreesFWD = inchesFWD*1.715625;
leftMotor1.spinFor(forward, degreesFWD, degrees, false);
rightMotor1.spinFor(reverse, degreesFWD, degrees);
leftMotor2.spinFor(forward, degreesFWD, degrees,false);
rightMotor2.spinFor(reverse, degreesFWD, degrees);
}

This is because spinFor is a blocking function by default. You already have the false parameter used to make it a nonblocking function but the placement is wrong. You need to have waitForCompletion be false on the first three. If you want the function itself to be blocking make the last one true and if not make it false.

1 Like

thank you. this stopped the blocking issue.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.