1

I suspect this is a very Naive question.
But the answer will teach me a lot.

Why does this circuit work when I connect the Digital Input (Digial Pin 2) to Pin 4 of the push button. But does not when I connect the push button to Pin 3. I missing something about how power flows when the button is pushed.

Ray K

  • Are you using the pin assignment convention of having pin 1 on the bottom left and counting up going counterclockwise? – Ignacio Vazquez-Abrams Sep 7 '15 at 15:34
  • Please clarify what pins you are talking about. In this case top-right, top-left, bottom-right and bottom-left would be a lot clearer. – Nick Gammon Sep 7 '15 at 20:36
3

Internally those little tactile switches look like this:

enter image description here

That means that the two pins on the same long side are connected together. So you can use, when you hold the switch vertically as in the image on the page you link to the two left-hand pins are linked together, and the two right-hand pins are linked together.

So you can use either both the top pins, both the bottom pins, or the top left and bottom right or the top right and bottom left.

Using either both left hand pins or both right hand pins will be as if you were sat on the button and it was permanently pressed.

  • ok - so let say I do the silly thing, and I connect the 5V VCC and the Digital Input (Pin 2) on the same long side. Is there then constantly power flowing to the Digital Input - making it impossible to differentiate between keypresses? – Ray Kinsella Sep 7 '15 at 16:28
  • 1
    Yep. That's it exactly. – Majenko Sep 7 '15 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.