View Full Version : programming question for bs2

08-21-2008, 03:05 AM
Hey i have a basic stamp 2 programming question.

I want to loop a section of code for 1 minuite and then have it go to another section of code. How could I do this?


08-21-2008, 03:43 AM
you will have to figure out (time) the time it takes to do the loop and then repeat the loop as many times as needed to equal a minute

- Stephen

Mike Green
08-21-2008, 03:48 AM
It helps to use a PAUSE statement to use up most of the loop time (if the loop doesn't do much). For example, you could use 100ms PAUSEs and yet still check switches over a minute like this:

cnt = 0 DO
cnt = cnt + 1
WHILE IN0 = 0 AND IN1 = 0 AND cnt < 600

The PAUSE occupies most of the loop time, so you may be able to ignore the execution time to keep the count and check the two switches.