Writting code for multiple microswitches connected to basic stamp II
ltmhall
Posts: 102
I have 6 microswitches connected to my robot. Three in the front
and three in the back. How would I write code for these switches.
From the Boe Bot manual I know for two switches connected in front
you can use If (IN5 = 0) AND (IN7 = 0) statement. Im just not sure how to write a program to check for 6 switches.
and three in the back. How would I write code for these switches.
From the Boe Bot manual I know for two switches connected in front
you can use If (IN5 = 0) AND (IN7 = 0) statement. Im just not sure how to write a program to check for 6 switches.
Comments
If (in5=0) AND (in7=0) AND (in8=0) THEN ......
You can also use the other logical operators ( OR, XOR, etc )
While learning this technique, also check out the idea of negative logic which can make OR look like AND !
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
http://www.kronosrobotics.com/an155/AAN155.shtml
A link to multiple switches using only one pin.