User Program has exceeded time limit of 3 seconds

Hi All,

This is more of a PSA than a question. I’ve run into this a few times while building very simple while loops to just control the drivetrain. The error can be avoided by adding a very small (.5 sec) wait step at the end of the loop.

I can only guess that the OS running the code has some kind of interrupt or monitor that needs the wait time to see that the code isn’t running wild. If anyone knows exactly why, I’d love to hear.

Jeff

are you using VEXcode and programming the IQ using C++ ? If so, yes, all loops need a small wait, a few mS will do. The reason is that a user program has to cooperate with the rest of vexos and allow background tasks to run occasionally. Programing using blocks or older environments like ROBOTC effectively add this type of call automatically, once you are programming with a native C++ compiler, you have to deal with this in the code.

14 Likes

Yes I am, and that makes total sense. Thanks for the explanation.

Just saying, since the wait can be just a few milliseconds, you should probably go down a a bit from 0.5, because that is a pretty long time.

2 Likes