int led = 5; // LED Anode pin int button = 16; // Push Button pin int temp = 0; // variable for holding the push button status void setup() { // initialize the LED pin as an output pinMode(led, OUTPUT); // initialize the pushbutton pin as an input pinMode(button, INPUT); } void loop() { // read the state of the pushbutton value temp = digitalRead(button); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (temp == HIGH) { // turn LED on: digitalWrite(led, HIGH); } else { // turn LED off: digitalWrite(led, LOW); } }