LOOP Command
turkeyus
Posts: 8
I would like to run a unit for 1hour.·I have been told to use LOOP, so tried and attached the code. Could you please give me a·feedback interms of it is correct or not or how can correct it. Also what if I want to run the unit for·60 minutes 10 seconds.·Can·I just add PAUSE 10000 at the end of the code?
Regards,
DO
· DO
····· PAUSE 60000····· '16 minutes,maximum allowable loop'
····· runtime = runtime+1
· LOOP UNTIL (runtime=16)
·rt=rt+1
LOOP UNTIL (rt=3)· '3x16=48 minutes"
DO
·PAUSE 60000
·runt = runt+1
LOOP UNTIL (runt=12)·· '48 minutes +12 MIN=1hr'
Regards,
DO
· DO
····· PAUSE 60000····· '16 minutes,maximum allowable loop'
····· runtime = runtime+1
· LOOP UNTIL (runtime=16)
·rt=rt+1
LOOP UNTIL (rt=3)· '3x16=48 minutes"
DO
·PAUSE 60000
·runt = runt+1
LOOP UNTIL (runt=12)·· '48 minutes +12 MIN=1hr'
Comments
Wait_Seconds:
· FOR tmr = 1 TO secs
··· PAUSE 1000
· NEXT
· RETURN
Wait_Minutes:
· FOR tmr = 1 TO mins
··· PAUSE 60000
· NEXT
··RETURN
Now your main program can call either subroutine as needed.· Let's say you wanted to delay·for one hour, five minutes, ten seconds.· You could now do it like this:
··mins = 65
· GOSUB Wait_Minutes
· secs = 10
· GOSUB Wait_Seconds
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax