/*Desig: Alberto E. Cohaila Barrios IES FPGV FabLAB Vigil Microcontrolador: ATMega328P Program: Pressing an external button turns on an LED */ int botonPin = 6; // Signal of sensor level --> pin 6 int ledPin = 13; // the number of the LED pin int estadoBoton=0; //Guarda el estado del boton void setup() { pinMode(ledPin, OUTPUT); pinMode(botonPin, INPUT); } void loop(){ estadoBoton = digitalRead(botonPin); if (estadoBoton == HIGH) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } delay(50); }