const int BTN_PINS[] = {11, 10, 9, 8};
const int LED_PINS[] = {5, 4, 3, 2};
void setup() {
Serial.begin(115200);
for (int i = 0; i < 4; i++) {
pinMode(BTN_PINS[i], INPUT_PULLUP);
pinMode(LED_PINS[i], OUTPUT);
}
Serial.print("Ready!");
}
void loop() {
for (int i = 0; i < 4; i++) {
if(digitalRead(BTN_PINS[i]) == LOW) {
Serial.print("Button ");
Serial.print(i + 1);
Serial.println(" pressed.");
}
}
}