mathertel / RotaryEncoder

RotaryEncoder Arduino Library
Other
328 stars 107 forks source link

add onChange callback? (Enhancement request) #31

Closed Llaves closed 3 years ago

Llaves commented 3 years ago

have you considered adding a callback that is invoked when the position changes? Kind of like your OneButton library where the click invokes a callback.

Seems straightforward to callback from tick(), but maybe I'm missing some complication.

Llaves commented 3 years ago

I've implemented and tested this functionality and submitted a pull request.

wotupfoo commented 3 years ago

If you're doing interrupt driven ticks() you wouldn't be able to call a callback. You'd need to use a semaphore.

mathertel commented 3 years ago

see discussion in pull request #32. closed here.