VEXCode V5 Multitasking Not running

Hello everyone!
I am a new student and recently tried to write a “multitasking” program.
If you add "controller " hardware to the subroutine, it will not work.

//////////////////////////////////////////////////////////////////////////
#include “vex.h”

using namespace vex;
vex::controller yaokong(controllerType::primary);

int myThreadCallback() {
int count = 0;
vex::thread::hardware_concurrency();
while (true) {
bool zheng = yaokong.ButtonX.pressing() ;
if (zheng == true) {
Brain.Screen.setCursor(1, 1);
Brain.Screen.print(“myThreadCallback has iterated %d times”, count);
count++;
this_thread::sleep_for(25);}

}

return 1;
}

int main() {

vexcodeInit();

thread myThread = thread(myThreadCallback);

int count = 0;
while (true) {

Brain.Screen.setCursor(2, 1);
Brain.Screen.print("main has iterated %d times", count);
count++;
wait(25, msec);

}
}

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