Timer

Has anyone used a timer to stop the bot from expanding early, and if so how? We are using vexcode pro v5. We keep having problems with that.

Could you send the code you are using to try and do that? It will help us help you

1 Like

I can not send a photo currently, because I do not have the laptop with me, but basically, I have a function that tells my endgame pneumatics to extend, so it will launch my endgame string. What I am trying to do is add timer, that will make it so it will not launch even if I click the button, until the last 10 seconds of the match. If needed, I can still attach a photo tomorrow.

Ok, what you do is

  1. before the user control while loop is entered, check what the brain’s internal timer is at, save that value in a variable
  2. during the driver control loop, check to see if the internal timer is 1 min 35 sec more than the initial time
  3. if it is and you are pressing the button to launch endgame, then launch endgame

If this doesn’t help, let me know and feel free to ask questions, I’d prefer not to just give you the code, but i can give a more in depth step by step guide

3 Likes

Do I have to clear the timer once before driver starts? Or will it clear itself once driver control starts.

Clearing it would be easier, then it is the same base to work from every time. @7996B was suggesting taking the value at the start of Driver, then using that as the base. Both achieve the same thing, but resetting it is probably cleaner to read.

4 Likes

What I can not figure out how to do is make the timer reset once, when the user control period starts. I should be able to get the rest.

1 Like

I understand it for the most part. The part I am trying to figure out is how can I reset the timer right when user control starts. If I do that, I already have found how to get the value, and all of that.

I was able to get it to work. Thank you for the help!