Hi everyone, I recently came into a problem when trying to code a stacking macro. I had previously made a task to let me drive my robot while it performed a towering macro, which went like this…
int myTaskCallback() {
int count = 0;
while (true) {
driveLeft.spin(vex::directionType::fwd, Controller1.Axis3.position(),vex::velocityUnits::pct);
driveRight.spin(vex::directionType::rev, Controller1.Axis2.position(),vex::velocityUnits::pct);
count++;
}
return 0;
}
it ended up working… however, after this I noticed that I could not drive back in my stacking macro for some reason not related to the build of the robot. I tried messing with thread callbacks, but nothing worked. Does anyone know how to fix this?
I would need to see more code to see if there are other issues but it’s worth noting that you do not have a pause in your while loop. The pause is necessary to allow the CPU to allocate time to other threads. As it is now, unless the compiler is smart enough to optimize it for you, the above thread will run continuously.