I started to work with Arduino couple weeks ago. I already created my first working sketch, which should control my blinds at home. For this I use the onebutton lib to support different commands depending of shortpress, double click or longpress. Right now my code is working as expected. I am little bit proud :)
My next step is to read out the button information with a Digital Input Modul (buttons with 24V), which is connected to my arduino via I2C.
My problem is, onebutton.cpp is only working with Arduino pins. :(
Is it a good idea to rework the onebutton.cpp in that way, that I hand over the relevant bit to the lib instead of "int pin"?
OneButton::OneButton(int pin, int activeLow)
activeLow should be also not necessary anymore, right?
Also pinMode not necessary: * // use the given pin as input* * pinMode(pin, INPUT);*
- // Detect the input information*
- int buttonLevel = digitalRead(_pin); // current button signal.*
Instead of digitalRead --> bitRead
Right now I am not sure, if changing the existing lib is a good solution for my application. Hope you could help me to find a working solution.