Any Spin code ideas for acceleration or velocity with rotary encoder?
Don M
Posts: 1,652
in Propeller 1
When using a rotary encoder for incrementing or decrementing 1 number per click to get to a large value it sometimes seems tedious.
On a digital clock for example when setting the minutes if you hold down either arrow key it will count up or down a minute at a time but continue to hold it changes 10 minutes at a time.
So I was wondering if anyone has implemented this sort of feature using a rotary encoder? If not- any suggestions how one might do this in Spin?
Thanks- Don
On a digital clock for example when setting the minutes if you hold down either arrow key it will count up or down a minute at a time but continue to hold it changes 10 minutes at a time.
So I was wondering if anyone has implemented this sort of feature using a rotary encoder? If not- any suggestions how one might do this in Spin?
Thanks- Don
Comments
It's all about time.
-- mark a new change
-- still changing?
-- if period met, change delta
Many encoders have buttons built in. If that is not being used for something else, you could use it to set the encoder delta (though it's tough to press and turn reliably).
Depends how many digits you need to set.
Button-in can select digit (left/right) then on release that digit INCs/DECs. A simple timeout can release set mode.
Mouse movement uses a non-linear approach, faster = adds more, so you could try that, but if you need more than 3 digits, the select-digit may be easier
If there is no button, just an encoder, maybe a combination of rate + timeout can apply.
Slow clicks is 'normal' but a fast-spin either way, goes to digit-select mode (fast flash digit Left/right active), moderate pause in clicks hops to INC/DEC that digit (slow flash), until a long pause exits set-mode. (no flash)
Fast spin would need to be discarded from INC/DEC, which could get tricky.
The fast-spin number might be usable to seed the digit, so a good operator could land on, or close to wanted digit.
If you display supports a means to indicate which digit you're changing, that's a good idea. On my road sign controller we uses a VFD that could set the brightness of individual characters to 1 of 8 levels, so it was nice for highlighting selected items.