// set the pins const int buttonPin = 7; // the pushbutton pin number const int ledPin = 8; // the LED pin number //set button as an variables int buttonState = 0; // pushbutton status as a variable 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 the pushbutton condition if (buttonState == LOW) { digitalWrite(ledPin, HIGH); // turn LED on: } else { digitalWrite(ledPin, LOW); // turn LED off: } }