Use two different functions at the same time

Hi guys, i have some questions about using task, i use pros, and for example i have a different fuctions to make an autonomous routine, i have a fuction to move an intake, another one for the lineal motion of the robot using a pid control, so i wanna use the pid fuction and simultaneously use the intake fuction, because i want that while the robot start moving, it can move the intake at the same time, so the robot could be able to take rings

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


This looks like code for the VEXcode Pro V5 environment: the user is using PROS, as stated in their post. These two coding environments are easily confused, so I understand if it was just a misunderstanding.

They have their own documentation on multitasking: Multitasking — PROS for V5 3.5.4 documentation

It looks like, in order to create a task, you just pass in a function pointer as an argument to the Task constructor. For example: Task intakeTask(intake).
The function does need to be defined in a specific way (the example on that page shows how it needs to be defined), but hopefully this should be enough information to get you on the right track.

1 Like