How to achieve multithreading


I wrote two functions, the functions are forward and pick up the ball. I want to move forward and pick up the ball at the same time, how should I modify the code

please paste your code in code blocks. I cannot see the image you sent as you misformatted the markdown.

such as:

void forwardTo(){


void takeIn(){


void autoCode(){

If I write the code like this, it will run the code in takeIn after the code in forwardTo is finished. I want two code blocks to run at the same time

You could put your function into something like

int Async (){
Stuff happens here at the same time


int main (){

vex::task t( Async );

other stuff happens



I’m primarily a builder/strategist on our team but do have some interest in coding. I do have basic coding skills but don’t know the how the vex code works. Would you be able to explain what part of the code allows the functions to run at the same time? Thanks!

The vex::task t(Async); part

1 Like