On switches again
Archiver
Posts: 46,084
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
{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