vex::task::sleep
takes in milliseconds and your code will stop for that amount of time, but I am not sure why you would want to put this in the beginning of your code.
The purpose of a sleep function is to allow the processor do other things like run another task and also to wait a certain amount of time. This is the reason why you would find a sleep in a while(true)
loop.
Something else to consider is that V5 has multiple cpu’s and stuff like sensor readings and communication with motors is handled regardless of what the user cpu is doing. So unless you have multiple task you technical don’t need a sleep in your while(true)
loop, though you can just put it in to not have problems later. If you do have multiple task sleeping is very important to let them all run since the CPU can only run one thing at a time. Calling sleep the CPU will pause your task and yield CPU it other waiting task. Although calling any system call (like getting motor speed) should also cause other tasks to run, but it might change in the future.
Also this post has some stuff about how v5 architecture works…