int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(A2, OUTPUT); // initialize the pushbutton pin as an input: pinMode(8, INPUT); } void loop() { buttonState = digitalRead(8); //asignamos un valor if (buttonState == HIGH) //comparamos el estado del boton con el valor HIGH // turn LED on: digitalWrite(A2, HIGH); else // turn LED off digitalWrite(A2,LOW); }