How to wire a three-pin on-off-on switch for reading input?
I suggest this simple circuit:



simulate this circuit &ndash; Schematic created using CircuitLab
Set both inputs to INPUT_PULLUP. If the input reads LOW, that means it has been grounded by the switch.

Edit: Per Duncan’s request, here is the alternative circuit with the polarities inverted. With the switch’s common connected to Vcc, the inputs should be set to INPUT_PULLDOWN. However, most Arduinos do not support this mode, for lack of internal pull-downs. Then one has to use external pull-downs instead, and set the pins to INPUT.



simulate this circuit
With this circuit, a pin reads HIGH when it is connected to +5V by the switch.