const int buttonPin1 = 34; // Pin del PRIMER BOTON
const int buttonPin2 = 35; // Pin del SEGUNDO BOTON
const int buttonPin3 = 32; // Pin del TERCER BOTON
const int LEDPin1 = 25; // Pin del PRIMER LED
const int LEDPin2 = 26; // Pin del SEGUNDO LED
const int LEDPin3 = 27; // Pin del TERCER LED
int buttonState1 = 0; // ESTADO del PRIMER BOTON
int buttonState2 = 0; // ESTADO del SEGUNDO BOTON
int buttonState3 = 0; // ESTADO del TERCER BOTON
void setup() {
pinMode(buttonPin1, INPUT);// CONFIGURACIÓN DE El PRIMER BOTON
pinMode(buttonPin2, INPUT);// CONFIGURACIÓN DE El SEGUNDO BOTON
pinMode(buttonPin3, INPUT);// CONFIGURACIÓN DE El TERCER BOTON
pinMode(LEDPin1, OUTPUT);// CONFIGURACIÓN DE El PRIMER LED
pinMode(LEDPin2, OUTPUT);// CONFIGURACIÓN DE El SEGUNDO LED
pinMode(LEDPin3, OUTPUT);// CONFIGURACIÓN DE El TERCER LED
}
void loop() {
buttonState1 = digitalRead(buttonPin1); // LECTURA DE ESTADO del primer BOTON
if (buttonState1 == HIGH) { // Si el BOTON cumple la condición actua en el LED correspondiente
digitalWrite(LEDPin1, HIGH); // cumple la condición y actua en el primer LED
} else {
digitalWrite(LEDPin1, LOW); // no cumple la condición y actua en el primer LED
}
buttonState2 = digitalRead(buttonPin2); // Leggi lo ESTADO del segundo BOTON
if (buttonState2 == HIGH) { // Si el BOTON cumple la condición actua en el LED correspondiente
digitalWrite(LEDPin2, HIGH); // cumple la condición y actua en el segundo LED
} else { // no cumple la condición
digitalWrite(LEDPin2, LOW); // no cumple la condición y actua en el segundo LED
}
// Leggi lo ESTADO del TERCER BOTON
buttonState3 = digitalRead(buttonPin3);
// Si el BOTON cumple la condición actua en el LED correspondiente
if (buttonState3 == HIGH) {
digitalWrite(LEDPin3, HIGH); // cumple la condición y actua en el TERCER LED
} else {
digitalWrite(LEDPin3, LOW); // no cumple la condición y actua en el TERCER LED
}
}