To learn more about switches, you should know about two concepts:
Hence, commonly switched are defined as “single-pole, single-throw” like tactile switch and “single-pole, double-throw” like slide switch of evive.
This is the simplest switch. It’s got one output and one input. The switch will either be closed or completely disconnected. SPSTs are perfect for on-off switching. They’re also a very common form of momentary switches. SPST switches should only require two terminals.
SPDTs have three terminals: one common pin and two pins which vie for connection to the common. evive has two slide switch which are SPDT type. Their common is high and the other two terminals are connected to digital pin 40 and 41 for slide switch 1, and 42 and 43 for slide switch 2. This means that when the switch slide up, pin 40 is high and when it slide sown, pin 41 is high, while both are low when the switch is in the middle.
In this example we will read the state of the slide switch and display it on the TFT Screen. Given below is the flow chart of the script.