Skip to content

Commit

Permalink
handle debounce in I2CKeypad_interrupts_1 example
Browse files Browse the repository at this point in the history
  • Loading branch information
raforg committed Aug 18, 2024
1 parent 222e837 commit 812dd39
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/I2CKeypad_interrupts_1/I2CKeypad_interrupts_1.ino
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ void setup()
while (1);
}

keyPad.setDebounceThreshold(50);

measurePolling();
}

Expand All @@ -89,6 +91,9 @@ void loop()
if (keyChange)
{
uint8_t index = keyPad.getKey();
// ignore key bounces
if (index == I2C_KEYPAD_THRESHOLD)
return;
// only after keyChange is handled it is time reset the flag
keyChange = false;
if (index != 16)
Expand Down

0 comments on commit 812dd39

Please sign in to comment.