// assigning a name is for attached by digital pin 2 with a button.
int button = 2;
// put your setup code here, to run once:
void setup() {
// setup serial communication at 9600 bits per second.
Serial.begin(9600);
// make the button's pin as input
pinMode(button, INPUT);
}
// put your main code here, to run repeatedly:
void loop() {
// get the input pin
int state = digitalRead(button);
// print out state of the button
Serial.println(state);
// delay 1 milliseconds in between readys for stability
delay(1);
}