I can't get the Metal Pushbutton - Momentary to work

Hi

I purchased these buttons thinking that they would be wired like a simple switch with a pullup resistor but I discovered that they have resistors already installed. It has a normally open wire and a normally closed wire. When I hook it to an Arduino using the example button script, and attach one of the NO or NC wires to pin 2 it sometimes works and sometimes does not.

Can anyone give me some tips about how to wire this thing up? Usually I just use a 10k Ohm resistor and I am good to go but apparently this switch is over my head.

This is the code I am using:

const int buttonPin = 2;  // the number of the pushbutton pin
const int ledPin = 13;    // the number of the LED pin

// variables will change:
int buttonState = 0;  // variable for reading the pushbutton status

void setup() {
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);
delay(50);
  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
    Serial.println("HIGH");
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
    //Serial.println("LOW");
  }
}

I got it to sort of work. I connected the normally closed pin to PIN 2 of the Arduino. Then I connected the common pin to a 10k Ohm resistor to ground. But it does not work unless I hold the button down for 3-4 seconds even though I only have a 100 delay on it. Once it engages it prints lines very fast.

When I use those standard buttons that come with every Arduino kit and press it it engages immediately. What would cause the delay?

I got it working! Normally closed blue wire to the Arduino Input pin. The Common green wire to ground. Then the thing that really did the trick was using INPUT_PULLUP to use the internal resistors in the Arduino like this ```
pinMode(buttonPin, INPUT_PULLUP);


I would still like to hear if anyone has any input on this. I am hooking 25 of these things to an Arduino Mega and I hope this new code keeps working.