This line is incorrect. Tasks take a pointer to a function as an argument, so you’d want:
vex::task check(DiscDetect);
See also this thread from James about the lifecycle of threads through each of the states a robot goes thru in a competition (e.g. Disabled, Auton, Disabled, Driver).
As James mentions, you are realistically more likely to go thru states:
- At queueing, or before placing the robot on the field, you turn it on and start the program. Main runs and you are in Driver Control mode.
- You place the robot and plug your controller into Field Control which Disables your Robot.
- Auton starts and you are in auton.
- Auton ends and you are Disabled.
- Driver control starts and you are in Driver.
During 5, if you disconnect or need to power-cycle your robot, you may also start right back up in Driver.
Depending on what you want this to do, you may want to start the task only in the usercontrol function rather than main.