int buttonState = 0; int buttonInput = PA3; int LEDOutput = PA7; void setup() { // initialize digital pin LEDOutput as an output. pinMode(LEDOutput, OUTPUT); // initialize digital pin buttonInput as an input. pinMode(buttonInput, INPUT); digitalWrite(LEDOutput, HIGH); // turn the LED on (HIGH is the voltage level) delay(500); digitalWrite(LEDOutput, LOW); // turn the LED on (HIGH is the voltage level) delay(500); } // the loop function runs over and over again forever void loop() { //buttonState == HIGH, when do not press button //buttonState == LOW, when pressing button buttonState = digitalRead(buttonInput); //do not press button if (buttonState == HIGH) { //turn LED off: digitalWrite(LEDOutput, LOW); } //pressing button else { //turn LED on: digitalWrite(LEDOutput, HIGH); delay(1000); // wait for a second } }