Skip to content
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

Request example code for rotary encoder with 10-bit precision (1024 steps) & 14-bit presicion (16383 steps) #927

Open
DRCRecoveryData opened this issue May 29, 2023 · 3 comments

Comments

@DRCRecoveryData
Copy link

Hi,

Could you provide example code for rotary encoder with 10-bit precision (1024 steps) and 14-bit presicion (16383 steps), i have plan to use with CD4051 for 27 rotary encoder 300 degree. also could you give example for CD4051 with roraty encoder too?

Best regards,

@tttapa
Copy link
Owner

tttapa commented May 29, 2023

Are you talking about rotary encoders or potentiometers. Rotary encoders don't have an absolute number of steps, they are endless, and their resolution is usually denoted in steps per revolution.

See the FAQ for an explanation of why you cannot use a CD4051 for rotary encoders: https://tttapa.github.io/Control-Surface-doc/Doxygen/da/dc1/FAQ.html#faq-mux-encoder

@DRCRecoveryData
Copy link
Author

DRCRecoveryData commented May 29, 2023 via email

@tttapa
Copy link
Owner

tttapa commented May 29, 2023

See the CC14Potentiometer class from #202 (comment). You can use it in the same way as CCPotentiometer, see the Getting Started guide to learn how to use multiple potentiometers on a multiplexer.

I wouldn't recommend increasing the resolution to 14 bits (MIDIFilteredAnalog<ContinuousCCSender14<14>>), because it is unlikely that your board has a 14-bit ADC (AVR boards have a 10-bit ADC, some newer ARM ones 12 or 13). Control Surface can give you a bit more precision because of its oversampling and filtering code, but that has its limits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants