Counting problem
ERM
Posts: 34
Hi guys,
I've seen it, but I can't find it now that I need it.
I want to run a counter from 40 to 100 at 20 step intervals and back down and repeat (i.e. 40 60 80 100 80 60 40 60 80 100... and so on). I can't remember the formula for it. I know it was an easy one as well. Can anyone help please.
Thanks,
Tony
I've seen it, but I can't find it now that I need it.
I want to run a counter from 40 to 100 at 20 step intervals and back down and repeat (i.e. 40 60 80 100 80 60 40 60 80 100... and so on). I can't remember the formula for it. I know it was an easy one as well. Can anyone help please.
Thanks,
Tony
Comments
That should work.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
·· Other than the DO...LOOP to cycle the whole thing over it is exactly what you asked for.· Without more details that's the best I can offer.· Your new details somewhat contradict the original post.· You mentioned increments of 20, but now you're mentioning increments of 1.· The DEBUG statements were there simply for filler, you could easily assign that counter to a delay or whatever.· Perhaps you should list exactly what you need to do.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
This one may be closer to what you wanted.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
'{$STAMP BS2}
reps VAR Nib
rate VAR Byte
x VAR Byte
rate = 100
variablespeed:
FOR x = 0 TO 5
FOR reps = 1 TO 2
HIGH 1
PAUSE rate
LOW 1
PAUSE rate
NEXT
FOR reps = 1 TO 2
HIGH 2
PAUSE rate
LOW 2
PAUSE rate
NEXT
PAUSE 2000
LOOKUP x, [noparse][[/noparse]80, 60, 40, 60, 80, 100], rate
NEXT
GOTO variablespeed
Thanks for the input guys, I really appreciated it.
You should see the values cycle through the values in the list.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows