While learning about switches, there are two important concepts that one should look into:
- Pole: The number of poles on a switch defines how many separate circuits the switch can control. E.g. switch with one pole, can control only one single circuit.
- Throw: A switch’s throw-count defines how many different positions each of the switch’s poles can be connected to. E.g. if a switch has two throws, each circuit (pole) in the switch can be connected to one of two terminals.
Switches are commonly are defined as single-pole, single-throw, such as a tactile switch, and single-pole, double-throw, such as a slide switch.
Single-Pole, Single-Throw (SPST)
This is the simplest switch. It has one output and one input. The switch will either be closed or completely disconnected. SPST switches are perfect for on-off switching. They’re also a very common form of momentary switches. SPST switches require two terminals only.
Single-Pole, Double-Throw (SPDT)
SPDTs have three terminals: one common pin and two pins which for connection to the common.
evive has two inbuilt 3-way slide switches. Slide switch 1 is connected to Arduino pins 40 and 41, both active high. This means that when the switch is slid up, pin 40 is high. When it slides down, pin 41 is high while both are low when the switch is in the middle. Slide switch 2 is connected to pins 42 and 43, and works in a similar manner as slide switch 1.
Example: Displaying the state of evive’s Slide Switch on TFT
In this example we will read the state of evive’s slide switch 1 and display it on the TFT Screen.
Below is the flow chart on which the sketch will be based:
Arduino IDE Sketch
Below is the sketch: