// Define los pines
const int buttonPin = 3; // Pin donde está conectado el botón
const int ledPin = 4; // Pin donde está conectado el LED
// Variable para almacenar el estado del botón
int buttonState = 0;
void setup() {
// Configurar pin del LED como salida
pinMode(ledPin, OUTPUT);
// Configurar pin del botón como entrada
pinMode(buttonPin, INPUT);
}
void loop() {
// Leer el estado del botón
buttonState = digitalRead(buttonPin);
// Comprobar si el botón está presionado
if (buttonState == HIGH) {
// Encender el LED