-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hardware abstraction should be by composition rather than inheritance #70
Comments
Hum, interesting. But how would this be implemented? |
I also want to find a way to do this, id like to be able to define a button instance with an input that is not digitalRead, maybe add in an override? |
@KenwoodFox this can already be implemented. See the source for You can set your custom override for digitalRead : |
This is pretty awesome! thanks so much. |
Sorry to ask, but where would you implement this? Should this be done for every button instance you create or do i need to make my own button class using inheriting from bounce? |
It isn't a complete replacement because it doesn't have complex debouncing techniques, but the |
Especially since there is a Button class now, the hardware abstraction should be done by composition rather than inheritance. For example, it's not possible to define a Button instance that uses something other than digitalRead to read the state. What do you think?
https://en.wikipedia.org/wiki/Composition_over_inheritance
The text was updated successfully, but these errors were encountered: