The diagram says a lot.
The end of the switches that is connected to the resistors should go to ground and the resistors should go to the pin ports.
Code:
PIN<--------->SWITCH<---------->GROUND
^
|
|
|
L----------->RESISTOR<-------->Vdd(power)
Port (pin) Logic is HIGH with switch idle, LOW when switch is pushed. This is for the first picture, when (unlike what you said) the resistors are tied to ground, In the second picture I can't see where they are tied.
Anyway I NOW understand what you are saying. What's going on is you push the button for a high, the port goes high, but when you release the switch, the port still reads high. That's called a "FLOATING INPUT" and a poor design. Use the logic I show above. It's a good way to keep the pins from floating (not high, not low, but read as high).
Bookmarks