mathertel / RotaryEncoder

RotaryEncoder Arduino Library
Other
328 stars 107 forks source link

Add support for implementing encoder acceleration #12

Closed deltaphi closed 4 years ago

deltaphi commented 4 years ago

This pull requests adds time-tracking between encoder increments. This allows a user of the library to determine the speed of rotation. The speed of rotation can be converted to an acceleration value.

mathertel commented 4 years ago

I like the additions. Can you provide an example for the timing please ?

deltaphi commented 4 years ago

Can you provide an example for the timing please ?

You mean as in "what does one do with the acceleration values"?

mathertel commented 4 years ago

yes, something like: how to implement larger steps when turning faster

deltaphi commented 4 years ago

I should be able to lift something from my actual application later today. Unfortunately I don't have the hardware setup to actually runtime-try a limited setup. My hardware involving the encoder is quite integrated.

deltaphi commented 4 years ago

Here is an example. I verified that it at least compiles with Arduino 1.8.7 for an Arduino Uno.

EDIT: The library compiles with PlatformIO for an ESP32 using Arduino. The examples actually use pin constants that are not defined for the ESP32, so they won't work without tinkering with the example sketches.

mathertel commented 4 years ago

Thank you !