I have a program that test a condition inside a if loop continuously during the run of the programme. But i want this if condition to become true or active for certain period of time(say for 5ms) and then deactivate the if condition for next 10ms. Then continue this pattern continuously until user close the program. I have no idea to approach this, please help me!
Share
I have a Suggestion for you…
Make a method and call this method when you want to start the process with TRUE value.
EDITED :-
You can use this Piece of code for Checking time elapsed for executing.
timeIntervalis the difference between start and now, in seconds, with sub-millisecond precision.Calculate the time Elapsed i.e timeInterval and check its value and compare it that whether it is < 5ms or 10 [self yourProcessMethod(TRUE/FALSE)];.
I hope this Helps you. 🙂 If yes, you can accept the answer or UpVote it 🙂