Introducing the Single-Pole, Double-Throw (SPDT) Switch
SPDT switches have three legs: one common leg and two legs that vie for connection to the common leg. The common pin is in the middle. It’s always connected to one of the outside pins, but which pin it’s connected to depends on which way the switch is flipped.
However you can use this switch as a Single-Pole, Single-Throw (SPST) Switch if you like. Simply ignore one leg.
If used as a SPDT switch, the other leg can be used to indicate a mode or state, rather than as a direct power switch. The state of the switch — “on” or “off”, or e.g. “mode A” vs “mode B” — is read from the common leg. A connected digital input pin on a microcontroller will read
HIGH when the common leg is electrically connected to the +V leg on the switch; that means the switch is “on.” It will read
LOW when the common pin is connected to the ground pin (switch in the “off” position).
This image shows input being read by a microcontroller that uses 3.3V (this is another common standard besides the 5.0V standard used on Arduinos).