Pretty sure this is a basic problem with some multiple button debounce code I've written.
When the button is held, load=true is triggered over and over.
When buttons = 6 (ie, not pin 5 as I should be), load = true is also triggered.
Code paraphrased for simplicity, as I'm sure this is a simple problem!
Thanks!
```
**bool load = false;
byte buttons[] = {5, 6};
int buttonState[] = {0};
int lastButtonState[] = {LOW};
long lastDebounceTime[] = {0};
long debounceDelay = 50;
void loop() {
checkInput();
if (load == true) {
loadPatch();
load = false;
}
}
void checkInput() {
for (int b = 0; b < sizeof(buttons); b++) {
int input = digitalRead(buttons[b]);
if (input != lastButtonState[b]) {
lastDebounceTime[b] = millis();
}
if ((millis() - lastDebounceTime[b]) > debounceDelay) {
if (input != buttonState[b]) {
buttonState[b] = input;
if (buttonState[b] == HIGH) {
if (buttons[b] == 5) {
load = true;
}
}
}
}
lastButtonState[b] = input;
}
}**
```