Añadí este código:
Código: Seleccionar todo
int reading = digitalRead(A2);
// check to see if you just pressed the button
// (i.e. the input went from LOW to HIGH), and you've waited long enough
// since the last press to ignore any noise:
// If the switch changed, due to noise or pressing:
if (reading != lastButtonState) {
// reset the debouncing timer
lastDebounceTime = millis();
}
if ((millis() - lastDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer than the debounce
// delay, so take it as the actual current state:
// if the button state has changed:
if (reading != buttonState) {
buttonState = reading;
// only toggle the LED if the new button state is HIGH
if (buttonState == LOW) {
pulsafn(Y_P_ROW, Y_COL, KEY_F5, 0, 0, 1, 1, 5);
}
}
}
Seguramente como dices también funcionará, pero de momento no lo voy a abrir de nuevo. Cuando lo abra de nuevo lo probaré.