Shop OBEX P1 Docs P2 Docs Learn Events
On switches again — Parallax Forums

On switches again

ArchiverArchiver Posts: 46,084
edited 2003-02-07 03:15 in General Discussion
Well, I used the:
{debounce from the stampworks manual with some minor alterations}
Fwdsw var in0
Revsw var in1
Gosw var in2
Main:
Gosub Getswitches
If switches & ( Fwdsw & Gosw ) then Fwdmotor
If switches & ( Revsw & Gosw ) then Revmotor
Goto Main

But it doesn't seem to work. The code will only read the first line
and then falls down from there.
I changed the variables to:
Fwdsw var switches.bit0
Revsw var switches.bit1
Gosw var switches.bit2
...And the If...Then to:
If Fwdsw & Gosw then Fwdmotor
If Revsw & Gosw then Revsw

It now seems to work fine. Does this seem right? Was I doing
something wrong? Any ideas would be great. I like to know why
something works and even more why it doesn't. Thanks.
Ian
Sign In or Register to comment.