A library for reading rotary encoders (ESP-8266 and Pyboard/stmhal)

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
User avatar
dhylands
Posts: 2374
Joined: Mon Jan 06, 2014 6:08 pm
Location: Shuswap, BC, Canada
Contact:

Re: A library for reading rotary encoders (ESP-8266 and Pyboard/stmhal)

Postby dhylands » Wed Jan 18, 2017 6:40 am

Interrupt callbacks can be class methods. This is a pyboard example, but see here:
https://github.com/dhylands/upy-example ... eat_irq.py
heartbeat_cb is an interrupt callback (and it's bound to the Heartbeat object created on line 19)

mattyt
Posts: 17
Joined: Mon Jan 23, 2017 6:39 am

Re: A library for reading rotary encoders (ESP-8266 and Pyboard/stmhal)

Postby mattyt » Wed May 24, 2017 1:22 pm

I just wanted to give a shoutout to SpotlightKid for submitting his Rotary Encoder library; I just cloned it, deployed it to my ESP8266 and it worked great! Admittedly not perfect debouncing but pretty decent and more than good enough for my use.

In the space of a night or so I now have a working(ish) LED strip light where the brightness is controlled by a rotary encoder - pushing it turns the strip on/off (with a fade). Less than 50 lines of hacky python code. Much appreciated @SpotlightKid!


Return to “Drivers for External Components”

Who is online

Users browsing this forum: No registered users and 1 guest