Having two things run at once

I have a problem that i cant find a simple solution to when I know there is on out there. I need a driver code that when I hit a button it will run through a sequence of code with wait commands, but, I need to also be able to drive during the whole thing. Is there a thread command or an easier way than having to refer to my drive code every time?

Sounds like you need a callback. Essentially, it starts an independent thread at the press of a controller button. (Using Controller.Button.Pressed())

Check out this thread

1 Like

thanks for the response, but I don’t think that helps for what I want it to do (sorry, I am bad at explaining things). but i think i found a solution i think i need to use thread(score).detach(); so it runs it at the same time.

If you are using c++ you may want to look into tasks. They allow you to run separate sets of code at the same time.

3 Likes

i found that thread(score).detach(); works for me, i just made a void function (in this example with the name “score”), and it will run both the “usercontrol” function at the same time as the “score” function

1 Like