I'm trying to figure out how to stop/interrupt a command that is in progress. During the command I have a servo turn and some lights turn on and stay on for around 10 seconds. I'd like to set it up so that if I press the switch again any time while the lights are still on, it switches them off and goes to the next command.
Heres my code:
Heres my code:
Code:
start:
servo 2,50
goto switch1
'--------------------------
close:
servopos 2,50
pause 50
goto lights1
switch1:
if pin3 = 1 then
pause 200
goto open
else
goto switch1
endif
'--------------------------
open:
servopos 2,1280
switch2:
if pin3 = 1 then
pause 600
goto close
else
goto switch2
endif
'--------------------------
lights1:
high 0
pause 400
low 0
pause 100
high 0
pause 100
low 0
pause 100
high 0
pause 100
low 0
pause 100
high 0
pause 10000
low 0
goto start
'--------------------------
Last edited by a moderator: