Quick question. I would like my Arduino to detect the position of a SP3T slide switch. What is in your experience the most efficient way of reading the slide position (minimum pin count, minimum resistors)?
The slide switch has 4 pins, 1 common pin, 3 pins where slide position determines if it is connected to common.
Any suggestions very much appreciated .
That is a SP3T. One pole, 3 throws.
Excuses. SP3T. Edited post.
Minimum components: common to GND, 2 (of the 3) positions to a pin, enable internal pull ups.
Minimum pins: 1 position to Vcc, 1 position to GND, 1 position to voltage divider (lets say 2x 1k), common to analog read.
Thanks! In my case a 1 pin + divider option would suit best.
On a side note, I seem to remember having to detect a tri state output on an MCP73832 charger IC. If I remember correctly this could be done using two pins as well (as per suggestion 1) but can't get my head around it anymore. It would entail connecting pin 1 to ground, pin 2 to HIGH and leaving pin 3 floating. Then connecting two gpio pins to common and doing two readings...
For option 1, both pins are pulled high. But if that position is selected that pin is connected to gnd. If both pins are reading HIGH you know it's in the third position
So you have (but maybe in a different order)
Position 1: LOW HIGH
Position 2: HIGH HIGH
Position 3: HIGH LOW
Ha, yes, I understand option 1 but was just thinking out loud about interfacing with a tri state output pin. Thanks again!