![]() |
Time/timer function
Hello,
I am trying to include a time/timer function so that in a while loop I can keep track of how long it has been and still being able to run other code. Also I would like to use it so that when I press a joystick button, the button is disable for say 1 second (so that it only registers 1 press and not registering from consistent pressing). Could demonstrate how this function works? Thanks, Davis |
Re: Time/timer function
Quote:
(button_is_pressed && button_was_not_pressed_in_previous_iteration) does what you want. It's true only in the iteration immediately after the button is pressed, and doesn't become true again until the button is released and pressed again. |
Re: Time/timer function
Thanks, that helps a lot!
Although I am still interested in learning how to use the time/timer feature. I'm not sure if there is a specific function that can be used as a timer, or if I have to get the time off the cRIO (if possible) and do my own math. Thanks! |
Re: Time/timer function
I use this macro.
Code:
#define GetMsecTime() (GetFPGATime()/1000) |
Re: Time/timer function
So i just add the #define up with the includes and use the function wherever I need to and do the math from there.
Thanks. |
Re: Time/timer function
Quote:
Code:
UINT32 startTime = GetMsecTime(); |
Re: Time/timer function
There is also a Timer class, but I don't like it much. Remember to call the Start() method if you use it.
|
| All times are GMT -5. The time now is 17:34. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi