Use `int pin_mode` instead of `bool pullupActive` in OneButton() constructor.
Use constructor:
OneButton(const int pin, const boolean activeLow = true, const int pin_mode = INPUT_PULLUP);
instead of:
OneButton(const int pin, const boolean activeLow = true, const bool pullupActive = true);
Use the given pin in input mode aka INPUT, INPUT_PULLUP, INPUT_PULLDOWN according to the Arduino board.
Like in the native Arduino function:
pinMode(pin, mode);
For example:
#if defined(BUTTONS_PULLUP)
userButton = new OneButton(aPIN);
//or it is equivalent to
userButton = new OneButton(aPIN, true, INPUT_PULLUP);
#elif defined(BUTTONS_PULLDOWN)
userButton = new OneButton(aPIN, false, INPUT_PULLDOWN);
#elif defined(BUTTONS_HIGH_IMPEDANCE)
userButton = new OneButton(aPIN, true, INPUT);
#endif
Hi @mathertel Matthias. First, I am glad to see new commits in OneButton lib.
Last time I used OneButton lib with ESP32 microcontroller under Arduino framework in PlatformIO. ESP32 has INPUT_PULLDOWN mode in Arduino pinMode(pin, mode) function.
This PR allows to use all pin modes. Could you please review the proposed changes and give your opinion on this PR. I can also correct lib examples and documentation.
Best regards. Ihor.
Please remove unused code. Please also update the documentation (README, CHANGELOG) Any changes in examples required ?
I found another solution for you using the new setup(...) function . See #129