//Use push button to turn an LED on when pushed and off when released
//Set the variables to hold the pin numbers to power the LED, and to connect to button
int ledPin = 2;
int buttonPin = 12;
int val = 0; //initialize a variable to hold the reading from the pin
void setup() {
//Set the pin modes
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
val = digitalRead(buttonPin);
digitalWrite(ledPin, val);
Serial.println(val);
}