One way that you can use a switch like this is to activate an Arduino program. This works just like any other external switch that you might use with an Arduino. Connect one wire to the GND pin. Then take the other wire and connect it to an input pin and also connect it to the 5V pin with a 1k resistor.
The resistor acts as a pull-up resistor. It will make the input pin read HIGH when the button is not being pressed. But when the button is pressed the switch connects the input pin to GND and the input will then read LOW. You can then use this signal to activate any kind of sequence that you like.
//Here is an example of code that you could use with this switch.
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() {
// 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);
// check if the pushbutton is pressed.
// if it is, the buttonState is LOW:
if (buttonState == LOW) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}