OP - You have to be very careful with your wording.
Emphasis mine. The title of this thread is “Timers (Java)”. In this and the previous thread, you’ve been asking about Timers, Iterative/Command programming, and websites. These questions have been confusing where your true gap in knowledge is.
What Oblarg has been hinting at is that you’re falling into the X/Y problem - you’ve pre-supposed a certain solution to your task, which may or may not be appropriate to the task itself.
To be fair - it’s very very hard to self-identify when you’re asking about Y, but really need to be asking about X. However, through the posts here, I’m pretty confident in saying: You’re barking up the wrong tree.
I’m asking you, please: Detatch yourself from the chosen solution. Talk about the task at hand.
You have stated:
Though there is no way I can code your whole robot for you, I am willing to provide you well-commented code to do this stated scope, if you can provide the following information:
- What port is the button plugged into on the roboRIO?
- Is the button “active high”, or “active low” (ie, what boolean values are seen in the code when the button is pressed, and not pressed?)
- What type of motor controllers are used for the motors? How many? What ports are they plugged into, or what CAN ID’s are they assigned?
- On the left side: does positive motor command make the wheels push the robot forward or backward?
- On the right side: does positive motor command make the wheels push the robot forward or backward?
- I assume that the motors should usually be all turned off, unless the button is pushed. Immediately after the button is pushed, they should run with a constant motor command for a fixed period of time. Is this correct? If so, what is that duration, and what is that motor command value?
- What should the robot do if the button is pushed while the motors are running? Does it need to change behavior?
Note: I provide this as a concise example of how to accomplish the stated task, and the comments and variable names chosen will be for educational purposes, so you can have a concrete example of how to accomplish your stated task. Though it will be functional, I will never sign up to say it is sufficient for any particular purpose or task or robot.