![]() |
Looking for help with creating a timer.
We want to use a timer for executing commands. (if x button is pushed than p happens and after a certain amount of time q happens) This would most likely be for controlling the solenoids on our robot so that with one button push a piston would extend before the other. We would also use it for driving functions.
|
Re: Looking for help with creating a timer.
you need to add a global variable at the top and if you put a counter in the while loop for autonomous you can count the iterations. this is the only way you can do it. if you put a delay in you will get the red light of death.
|
Re: Looking for help with creating a timer.
For MPLAB IFI/Watson based programming...
To use a real timer take a look at the IFI explanation in this white paper: http://www.ifirobotics.com/docs/time...004-jan-14.pdf Kevin Watson has some examples here: http://www.kevin.org/frc/2005/ |
Re: Looking for help with creating a timer.
use a "wait" function in the code
if(button){ do thing one; Wait(3000); do thing two; } The value inside the "wait" function is in milliseconds, so the above code would pause for 3 seconds between thing one and thing two. |
Re: Looking for help with creating a timer.
For Easy C or WPILIB based programming ...
Quote:
|
Re: Looking for help with creating a timer.
Quote:
-Kevin |
Re: Looking for help with creating a timer.
the program loops at 36 times a second. With this knowledge, you could create something that would measure this. I wouldn't advise letting a counter variable get into the thousands, because then the program starts running slower. something like this worked nicely for me:
Code:
//global variables |
Re: Looking for help with creating a timer.
The code says we are missing IFI_FRC.h
|
| All times are GMT -5. The time now is 00:56. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi