mathertel / RotaryEncoder

RotaryEncoder Arduino Library
Other
344 stars 107 forks source link

Store two values #33

Closed erickdau closed 2 years ago

erickdau commented 3 years ago

Hey Matthias, what a nice library!

I'm trying to make the same encoder kin of work as two. My idea is to have it's rotation to change a Lightroom parameter, and when I click the button, it will change another one. I could make it switch between the parameters - which means sending two different MIDI CC values - but when I switch from one to another, the value will be stored. So, say I changed Brightness to 10, and clicking the button will change the encoder to Contrast, Contrast will be on 10. If I raise it to 40, clicking back to Brightness, it will start from 40. My guess is that the encoder is storing this absolute value, so I tried changing the library a little bit, setting different encoders, different getPositions, but in the end I failed. Do you have any idea??

Thanks man!

mathertel commented 2 years ago

I have a more complex example doing this in https://github.com/mathertel/Radio/blob/master/examples/WebRadio/WebRadio.ino In function doMenuClick() you can see how to use the setPosition() function to switch from the current value of each parameter: from Volume to Mono to Mute to Frequency .