Browse Source

Improve debounce

main
fluffy 5 months ago
parent
commit
dd281a74fa
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      DDRuino.ino

+ 2
- 2
DDRuino.ino View File

@@ -11,7 +11,7 @@
//#define DEBUG

//! Debounce time in milliseconds
constexpr int debounceTime = 20;
constexpr int debounceTime = 10;

//! Input button
struct Input {
@@ -63,8 +63,8 @@ void loop()
Serial.print('\n');
#endif

unsigned long now = millis();
for (auto& i : mapping) {
unsigned long now = millis();
bool val = !digitalRead(i.pin);
if (val != i.pressed && (i.lastChange + debounceTime) < now) {
if (val) {


Loading…
Cancel
Save