Category Archives: Microcomputers
See the picture  below. When the switch is connected, the input pin will get the high level. But what if the switch is not connected. It is hard to tell the input pin will be read as high or low. Also the value of the input pin is very much susceptible by noise. This phenomenon is referred as floating.
A resistor (usually more than 10KΩ. See the picture  below) can guarantee that the value of the input pin is high when the switch is disconnected.
For more details, reading  is recommended.