I'm a rookie, but I think using subs will work like this. Subs have to be after the "end" statement.
OR, you could move each of the items below each if statement.Code:main if switch1 = 1 then GoSub servocenter if switch1 = 0 then low led1 if switch2 = 1 then GoSub servoright if switch2 = 0 then low led2 if switch3 = 1 then GoSubservoleft if switch3 = 0 then low led3 if switch4 = 1 then high led4 if switch4 = 0 then low led4 goto main end servocenter: serout lcd1, t9600, [$fe,1," center"] high led1 pulsout servo1, 150 pause 200 Return servoright: serout lcd1, t9600, [$fe,1," right"] high led2 pulsout servo1, 100 pause 200 Return servoleft: serout lcd1, t9600, [$fe,1," left"] high led3 pulsout servo1, 200 pause 200 Return
Code:main if switch1 = 1 then GoSub 'servocenter serout lcd1, t9600, [$fe,1," center"] high led1 pulsout servo1, 150 pause 200 endif if switch1 = 0 then low led1 if switch2 = 1 then GoSub 'servoright serout lcd1, t9600, [$fe,1," right"] high led2 pulsout servo1, 100 pause 200 endif if switch2 = 0 then low led2 if switch3 = 1 then GoSub 'servoleft serout lcd1, t9600, [$fe,1," left"] high led3 pulsout servo1, 200 pause 200 endif if switch3 = 0 then low led3 if switch4 = 1 then high led4 if switch4 = 0 then low led4 goto main




Bookmarks