This question is probably extremely basic, but I just can't figure it out after reading a bunch of tutorials and explanation pages about it.
If I understand the schema above correctly, the circuit can be in one of these two states:
1: Button is pressed, input pin reads a direct 5V from the Vcc and reads HIGH. 2: Button is not pressed, input pin reads 0V from ground(if it's not connected to the ground, the pin will read random noise from the environment?)
The second state confuses me a bit(probably because I don't quite understand the concept of ground). Why do we need a resistor between the ground and the second leg of the button? ground always reads 0V right? What is the purpose of the resistor?