The function of the switch is to connect or disconnect the circuit. Two status values can be read on the digital IO port of Arduino, one is high level (5V) and the other is low level (0V). So as long as we design a circuit that allows the Arduino pin to switch between these two high and low state values, we can tell the Arduino to distinguish the switch state.