Wrote a library for Circuitpython that tries to do most of what the OneButton Arduino library does. It handles one or more buttons – debouncing, single click, long presses, and holding. Written to be non-blocking so that it plays nice with the rest of your code, and easy to implement with just a couple lines.
Check it out on github: https://github.com/elliotmade/This-Button
Sorry to ask about such an old post but I just came across your article for reverse engineering a treadmill motor control….. Just what was looking for. Just curious… did you ever get it finished & installed?…. and if I want to do the same thing…. what sort of rotary encoder would I use?…. Thanks…. great work!
Hey yes! It is up and running on a belt grinder, results are satisfactory. Any encoder you want really – it’s up to you what you want for a user interface. This is what I am using: https://www.amazon.com/DIYhz-Rotary-Encoder-Digital-Potentiometer/dp/B07D3DF8TK/
Cheers!