Most of the inputs (sensors) connected to Arduino work by exploring some kind of Voltage Divider.
As the name gives it away, a voltage divider splits the voltage of a circuit in two parts.
in the above circuit, the voltage between
Imagine that you replace either
Pull-up and pull-down resistors are useful because without them the inputs that read
Pull-up/down resistors stop the circuit from floating. Frequently new users setup a switch in series between 5V and the input PIN on Arduino, without a pull-down resistor. They assume the PIN to be at ground level. This is wrong.
The input PIN is floating. This means that its reading will be subject to whatever momentary internal currents are flowing through the internals of the Arduino. If you try to setup the switch in this way you’ll find that it will act in an apparently random way. It might read LOW most of the time, but sometimes it will read HIGH with the switch open. Not desirable at all. ALWAYS USE A PULL-DOWN/UP RESISTOR.