tttapa / Control-Surface

Arduino library for creating MIDI controllers and other MIDI devices.
GNU General Public License v3.0
1.23k stars 139 forks source link

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

Open DRCRecoveryData opened 1 year ago

DRCRecoveryData commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Ah i'm wrong, "rotary knob precision" can you create code for potentiometers?

Get Outlook for iOShttps://aka.ms/o0ukef


From: Pieter P @.> Sent: Monday, May 29, 2023 8:35:07 PM To: tttapa/Control-Surface @.> Cc: Nguyen Vu Ha @.>; Author @.> Subject: Re: [tttapa/Control-Surface] Request example code for rotary encoder with 10-bit precision (1024 steps) & 14-bit presicion (16383 steps) (Issue #927)

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

— Reply to this email directly, view it on GitHubhttps://github.com/tttapa/Control-Surface/issues/927#issuecomment-1567148047, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUKDPPBVECRZEYYO3MXECYLXISQYXANCNFSM6AAAAAAYSZPBDA. You are receiving this because you authored the thread.Message ID: @.***>

tttapa commented 1 year ago

See the CC14Potentiometer class from https://github.com/tttapa/Control-Surface/issues/202#issuecomment-634034911. 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.