Hi
The example for the Bounce library needs constructor parameters and an extra call in setup:
---
#include <Bounce.h>
const int buttonPin = 12;
Bounce pushbutton = Bounce(buttonPin, 10); // 10 ms debounce
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
}
---
Is there a reason that the pinMode can't be called from the constructor?
I would like to use the Bouncer object inside another class and pinMode call inside setup is awkward and a possible cause of problems.
Alain
The example for the Bounce library needs constructor parameters and an extra call in setup:
---
#include <Bounce.h>
const int buttonPin = 12;
Bounce pushbutton = Bounce(buttonPin, 10); // 10 ms debounce
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
}
---
Is there a reason that the pinMode can't be called from the constructor?
I would like to use the Bouncer object inside another class and pinMode call inside setup is awkward and a possible cause of problems.
Alain