Skip to content

Switch Connections

Dlloydev edited this page Jun 13, 2022 · 1 revision

Switch Connections

Switching between GND and digital pin is the default solution used by this library. External pull-up resistors can be added if desired, but the internal pullups should be sufficient for most applications. What might be of consideration is providing sufficient wetting current to overcome switch contact oxidation.

A set of connections are shown where 0.1μF capacitors are optionally added. This adds contact wetting current and hardware signal filtering (beneficial for interrupt applications) .

Connections shown below are for 2-position switches (SPST, SPDT, DPDT) using 1 input:

image

image

Connections shown below are for 3-position switches (SP3T, DP3T) using 2 inputs:

Toggle Switch (SP3T, On-Off-On):

image

Slide Switch (Single Pole, 3-position):

image

Rotary Switch (Double Pole, 3-position):

image

The switch functions when using 2 input pins:

isUP();
isMID();
isDN();
UPtoMID();
MIDtoDN();
DNtoMID();
MIDtoUP();

The switch has 3 positions referred to as UP, MID (center) and DN (down). The first 3 functions will continuously return true if the switch is at that position. The last 4 functions return true (once only) if the switch has just transitioned to that position.