Similar to digital output, digital input only considers HIGH or LOW voltages. In the following we will use switch to control the LEDs, by checking the voltages of the current is closed or opened.
In electrical engineering, a switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another.
In short, we have two ways to use the switch (generate HIGH and LOW inputs):
Positive Logic – low voltage for a 0 bit (OFF) and high voltage for a 1 bit (ON).
Negative Logic – high voltage for a 0 bit (OFF) and low voltage for a 1 bit (ON).
Imagine the measure point is connect to ground with very high resistance, therefore we can measure the voltage with only a very small current flow through the measure wire. In the workshop we usually use the positive logic, because it is more easy to understand.
To read signal from a pin of the Arduino board, we need to set the pin mode to INPUT and read the digital signal
pinMode(pin, mode) : set the pin mode
digitalRead(pin) : read the pin