sequences and input
kaz
Posts: 2
hi,
we are trying to make our stamp listen for an input sequence. we've tried embeded if statements and they don't seem to want to work.
anyone know how to make this work?
we are trying to make our stamp listen for an input sequence. we've tried embeded if statements and they don't seem to want to work.
anyone know how to make this work?
Comments
so, we are trying to figure out how to make the stamp listen for when 1 switch is pressed then another.
something like this:
if switch1 = 1 then switch2 = 1
do this
that part is easy, but we also need it to do the reverse
so
if switch1 = 1 then switch2 = 1
do this
if switch2 = 1 then switch1 = 1
do this2
so we need the stamp to distinguish the order of the switches being triggered
state VAR Nib
stateOld VAR Nib
DO
· state.bit0 = switch1
· state.bit1 = switch2
· IF state <> stateOld THEN
··· SELECT state
····· CASE %00
·······action = Do_Something
···· CASE %01
······ action = Do_Another_Thing
···· CASE %10
······ action = Do_That_Other_Thing
···· CASE %11
······ action = Fall_Over
···· ENDSELECT
· ENDIF
· GOSUB Perform_Action
· stateOld = state
LOOP
state VAR Nib
stateOld VAR Nib
DO
· state.bit0 = switch1
· state.bit1 = switch2
· IF state <> stateOld THEN
· · IF state = %01 AND stateOld = %10 THEN
· ··· action = Do_Something
·· ·ELSEIF state = %01 AND stateOld = %11 THEN
·· ·· action = Do_Another_Thing
··· ELSEIF state = %10 AND stateOld = %00 THEN
····· action = Do_That_Other_Thing
···· .
·· · .
··· ·.
·· ·ENDIF
· ENDIF
· GOSUB Perform_Action
· stateOld = state
LOOP
Post Edited (Andy Lindsay (Parallax)) : 2/14/2006 6:49:14 PM GMT