// constants used to set pin numbers: const int buttonPin = 3; // Pushbutton pin const int ledPin = 7; // LED pin // variables: int buttonState = 0; // variable for reading the Pushbutton state 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 : buttonState = digitalRead(buttonPin); // check if the Pushbutton is pressed. If it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, LOW); } else { // turn LED off: digitalWrite(ledPin, HIGH); } }