How to use this button?

In designing a project recently, I wanted a little extra flair for my buttons, so I bought a couple of these and one of these. The bigger ones in the first link worked great; they have two wires for the lighting around the edge of the button, and three wires for the switch functionality just like you’d expect. But the one in the second link, without the lighting, only has two leads. So (and, by the way, I’m a complete beginner with this stuff) with two leads instead of three, I don’t know how to read any information into my Arduino board with it. One lead is presumably voltage, and the other is ground, but how do I get my arduino to read whether the button is pressed or not? Or have I just bought a button not designed for electronics like this? I wired it up to just a battery and LED to test, and the light is on when the button is default, and off when it’s pressed (I think; now I forget). Also, if the two metal leads are at 12 o’clock and 6 o’clock, it has two slits at 3 and 9, with “+” and “-” symbols next to them. Some pictures are attached. Thanks in advance for any help!

Button leads don't have a direction. The +/- only matters for the internal LED.
Buttons are just switches that close circuits. It's either momentary (closed only while you hold it down) or latching (press to close, press again to open, etc)

A simple continuity test with a multimeter will make the button operation obvious to you. In terms of using it with an Arduino, look at any tutorial involving a button. There are tons of them.

To add to what INTP offered, there is a third type of push button: Normally Closed. So, here are the options:

  1. Normally Open -- when you push the button it closes the inner contacts, when you release it, they open.
  2. Normally Closed -- the opposite of Normally Open (push to open and release to close).
  3. Toggle -- push once the contacts close. Push again, and they open.
  4. There is also a button that is both normally closed AND normally open. It has three terminals. The common terminal, the normally open terminal and the normally closed terminal.

Then, there are the lighted buttons -- basically one of the same four types, but with an internal light that, typically, turns on in one of the two states, and turns off in the other state.

Thanks for taking the time to respond. Yes, it's a momentary button, and it does work. But it's different from other buttons I've used in that they have three or four leads, where this only has two. So in button tutorials, you'll connect one lead to 5v, one to ground, and one to a digital pin, which will read whether the current is reaching ground (I think?). But this one is missing that third contact.

When I look at this schematic from the button tutorial on the arduino site, it looks like the wire that goes to the digital pin just branches off the 5v wire, after the resistor. So maybe I add my own 3rd contact this way, basically going 5v > resistor > two wires, one to the button, one to a digital pin > the other contact of the button goes to ground. Sound good?


Once you understand the purpose of a pullup/pulldown resistor, you should see the simplicity that you are managing to severely overcomplicate.
3-contact buttons are not the norm and if you think they work like you said, you are mistaken. Even those 3-contact ones will need pullup/pulldown resistors.

Your 2-contact button isn't missing anything. A button will connect an input pin to either ground or 5v. That's step one. That determines what the pin will see when the button is pushed. Pushing the button is just like having a straight wire going from the input to either ground or 5v, and it will read LOW or HIGH, respectively. Step two is using a pullup or pulldown resistor, depending on whether you chose to run the button to ground or 5v, respectively, so that you can guarantee the state of the input pin when the button is NOT being pushed.

The Arduino has internal PULLUP resistors, which is why most sensible setups will use buttons that go from input pin to GROUND. Do a pinMode(pin#, INPUT_PULLUP) and you don't have to add your own resistor. The pullup makes it so the input pin will always be HIGH until the button is pressed, then it will read LOW.

LOW and HIGH are simply two states a boolean variable can exist in.
They do not automatically correlate to OFF and ON.
That fact is what seems to confuse a lot of amateurs who haven't bothered to understand the basic concepts of coding.

You can make an LED turn on when a pin reads HIGH, just as you can make an LED turn on when a pin reads LOW, just the same.
You can even turn ON that LED by writing it HIGH, just as you can turn ON that LED by writing it LOW. All depends on how you have the LED physically connected. For example, the LED can be turned on by writing it LOW when you have the LED running from 5v to the IO pin, and the IO pin is sinking current.

the most simple button (or switch) will have two leads;

either it looks like this;

or this;

have a read of this for more detail;

Appears to be a simple momentary contact, 2 wire pushbutton switch, one wire to GND, other to pin 4 (or whichever), pin will go LOW when button is pressed.

void setup()
void loop(){
  digitalWrite(LED_BUILTIN, digitalRead(4) == LOW);

EDIT: Inserted "switch" after "pushbutton" so @PaulS won't "git" me. 8)

For a full discussion of this topic see:- Inputs

Thank you everyone! Huge help.