How to measure a switch position in a very unique circuit

Hi,

I'm working on a circuit involving a 2 position toggle switch and an Red + Blue LED (Common cathode). The switch toggles the led color depending on its position.
I need to know the position of the switch inside the arduino.
I have only one GPIO input left on the arduino.
I also have common anode bi-color LED I can use instead.

Any idea how I can do it ?



Either setup is easy enough to try, eh?
I'd be more inclined to say the 3rd might work better.

Look at the [u]Digital Read Serial Example[/u] which uses a pull-down resistor.

With the switch in the "red" position D2 is pulled-low by the resistor. When you switch the "blue" the pull-down resistor is "overpowered" by the direct connection to +5V and D2 reads high. (And current flows through the resistor... A small-insignificant current if you have a high-value resistor, such as 10K.)

Oh I get it now

Thanks