diff --git a/Bounce2.cpp b/Bounce2.cpp index b5265ee..c947815 100644 --- a/Bounce2.cpp +++ b/Bounce2.cpp @@ -33,13 +33,8 @@ void Bounce::attach(int pin) { #endif } -void Bounce::attach(int pin, byte mode){ - if(mode == INPUT_PULLUP){ - pinMode(pin, INPUT_PULLUP); - } - else{ - pinMode(pin, INPUT); - } +void Bounce::attach(int pin, int mode){ + pinMode(pin, mode); this->attach(pin); } diff --git a/Bounce2.h b/Bounce2.h index 2d44f7c..77d384d 100644 --- a/Bounce2.h +++ b/Bounce2.h @@ -47,6 +47,9 @@ class Bounce // Attach to a pin (and also sets initial state) void attach(int pin); + + // Attach to a pin (and also sets initial state) and sets pin to mode (INPUT/INPUT_PULLUP/OUTPUT) + void attach(int pin, int mode); // Sets the debounce interval void interval(uint16_t interval_millis);