I am using the BCM-notation for the nodes of the GPIO. Consider the following situation.
- node 1 (3,3V) is connected to a switch-key
- the switch-key is connected to node 25 via 1 kOhm
- node 25 works as an input
- node 24 works as an output which is true when the switch-key is pressed, that is when node 25 is true.
- node 24 is connected to a LED via 220 Ohm
- this LED is connected with GND
What happens now is that the LED is turning on and off randomly. What you need to do is add a pull-down resistor. This works as following:
- connect the switch-key with GND via 10 kOhm
If the switch-key is not pressed, nothing is connected to each other. How can the pull-down resistor have any influence in this system? I am using a switch-key with 4 contacts.
To sum my problem up:
- Contact 1 of the switch-key is connected to node 1 (3.3V)
- Contact 2 of the switch-key is connected to node 25 (INPUT) via 1 kOhm
- Contact 3 of the switch-key is connected to GND via 10 kOhm.
- Contact 4 of the switch-key is not used
How can the use of the 10 kOhm have any influence on the system, while the switch-key is not pressed?