Momentary button setup
2011-Feb-17, Thursday 03:34 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
More for myself than anyone else, I often have trouble remembering how to set-up my 4-leg momentary buttons, so I'm making this reminder.
The button has four legs, two pairs of two essentially. The pairs have the flat ends facing each other, like brackets; { }. These pairs are connected when the button is not pressed, and current can be measured across them. When the button is pressed it switches (no pun intended) to flow from one of each pair, to its opposite counterpart. So really, only need to use two of the legs (one of each pair).
(Click for larger versions.)

See the two unused legs positioned down the trough, off the breadboard?

Rotated 90-degrees. Power comes in (top orange) from the power-rail down the side of the breadboard, into one leg of the button. On the opposite side a resistor is next to the button leg. At the other end of the resistor is a lead (white) going to ground. In the same row as a button leg and the resistor (but after the resistor) is another lead (orange again, sorry, ran out of colours) that goes out of picture, to a digital-input pin on the Arduino board.
Then measure for a HIGH signal in the code to detect a button press.
The button has four legs, two pairs of two essentially. The pairs have the flat ends facing each other, like brackets; { }. These pairs are connected when the button is not pressed, and current can be measured across them. When the button is pressed it switches (no pun intended) to flow from one of each pair, to its opposite counterpart. So really, only need to use two of the legs (one of each pair).

See the two unused legs positioned down the trough, off the breadboard?

Rotated 90-degrees. Power comes in (top orange) from the power-rail down the side of the breadboard, into one leg of the button. On the opposite side a resistor is next to the button leg. At the other end of the resistor is a lead (white) going to ground. In the same row as a button leg and the resistor (but after the resistor) is another lead (orange again, sorry, ran out of colours) that goes out of picture, to a digital-input pin on the Arduino board.
Then measure for a HIGH signal in the code to detect a button press.