My timer isn't working

I have a v5 brain. In my VEXcode pro, I wrote a simple loop to test built-in that is

void autonomous(void) {
while (Brain.Timer.value() < 3){
But when I start timed-run the motor isn’t stopping. Can someone please say why is this happening ?

I believe the reason is you actually have to tell the motor to stop at some point, once you put it in that forward state it doesn’t stop automatically.

I would most likely put it right after the while loop.

Yeah I realized that when I created the topic here :smiley: The problem is, I converted that while loop to a if else loop and the problem didn’t change :confused: And I dictated the “time” to the VEX Brain but it is not counting or changing too. So as a conclusion, we could say, my timer is not counting even I reset it in the pre_autonom or in the autonom or in a custom func.

I don’t have any experience with the Brain timer so I unfortunately can’t help much with that problem, but I 100% do not recommend using the timer for your autonomous. The program will be incredibly unreliable and inconsistent. Instead, you should use the built-in motor encoders or some other external sensor to track how far you’re moving.


The code above ahead is just a little example to show my timer isn’t working. I aggree with your reccomendation of course and I use encoders in my code. But the point is, my timer is not working in any time. Not in autonomous not in user control. So why it is not counting? That’s my question. People around forums had said timer needs to be resetted. I resetted in pre_autonomous or in a function. But still, it is not counting :confused:

I’m sure it’s working, just used incorrectly, perhaps post the code as you currently have it. It should be something like this.

int main() {   

    while( Brain.Timer.value() < 3.0 ) {
      Brain.Screen.printAt( 10, 50, "Time %6.2f", Brain.Timer.value() );

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.