Running multiple loops at once
surfline27
Posts: 8
Hi
I'm new at Basic Stamp (and programming in general) and I was wondering if there is a way to run simple multiple loops at the same time.
EDIT: I'm using this code with the BoeBot Robot Kit, so what I'm trying to do is have blinking lights, beeping and movement at the same time
Like for example if I want all three loops below to run simultaneously, how can I do it?
Thanks
I'm new at Basic Stamp (and programming in general) and I was wondering if there is a way to run simple multiple loops at the same time.
EDIT: I'm using this code with the BoeBot Robot Kit, so what I'm trying to do is have blinking lights, beeping and movement at the same time
Like for example if I want all three loops below to run simultaneously, how can I do it?
DO HIGH 13 HIGH 12 PAUSE 500 LOW 13 LOW 12 PAUSE 500 LOOP DO FREQOUT 4, 500, 5000 LOOP DO PULSOUT 13, 810 PULSOUT 12, 720 LOOPAny help would be greatly appreciated.
Thanks
Comments
What you want to do can be done, but for the LED blinking you cannot use PAUSE statements and the FREQOUT command would need to be a shorter duration, which will also cause it to sound like it is beeping in short bursts. For the LEDs you would use a passive loop with a counter and this would also require some empirical testing to get the right value.
FOR W1=1 to 500
PULSOUT 13, 810
PULSOUT 12, 720
PAUSE 20
NEXT
Get that doing what you want, then slowly work in toggling LEDs and getting some sound bursts out. Everything must be woven together around the 50 hz pulse trains required to keep your servos happy.