how do I loop for x seconds?
pico
Posts: 29
in Propeller 1
hey guys,
how do I loop a function for a certain number of seconds?
Thanks!
how do I loop a function for a certain number of seconds?
Thanks!
Comments
2. repeat the loop 1_000 or 1_000_000 divided by the know loop time.
If x < 27, use this:
Otherwise, this:
In both cases, it's assumed that "do stuff" doesn't take very long to perform.
-Phil
-Phil
Um, if ints are signed, that won't work. Also, even if ints are unsigned, that code is only good for times less than 54 seconds.
-Phil
The first one with x < 27 seconds:
I needed to keep track of the time and then do something and I needed multiple timers to do it so I wrote a library function for it.
Buy passing in a long variable you can keep track of multiple time instances.
You can also use the mstimer.h library that starts a cog with the time in it.
Mike