Your description lost a little in the translation. Are you looking for two statyes out of your loop, or three? For two states, make your pin an input, and it it is on a port with weak pull up, enable it. If not, place a 47K resistor between the pin and B+. Drop the resistor to ground to 1K and when the switch is opened, the port will read high, when closed, it will read low.
Hope this helps,
Ron
Bookmarks