Rotary Encoder Adaptive Output

I am a video editor trying to build an arduino computer controller using the arduino pro micro 32u4. I want to be able to determine the speed of the encoder. For example, in my editing software left and right arrows move one frame at a time, and j and l play shuttle at double and triple speed. So, when I spin the encoder fast it will type j and l and when I spin slow it will type left and right arrows. I have working code, but it types left and right arrow in between the j and l. I want to be able to do multiple fast spin and not type arrows in between.

Encoder_with_Fast_Spin.ino (2.17 KB)

Read the forum guidelines to see how to post code. More members will see properly posted code.

It'll be much easier to find a library that can do what you want than writing your own code. This one has an acceleration variable that you can probably use. GitHub - 0xPIT/encoder: Atmel AVR C++ RotaryEncoder Implementation

There's a better option though, I'd suggest using a joystick as well as the encoder.

Traditionally video editors use a knob attached to an encoder for jog (frame by frame) with a separate spring loaded ring around for shuttle (speed) control. I haven't been able to find one at a reasonable price, however a play station style joystick works very well. Push the joystick a little way and it sends the L character for double speed. Push a little further it sends another L for triple speed. As you bring the stick back it sends J (or whatever is required) to slow the video down to double speed and when it comes back to the centre it sends K to get you back to single speed.

Keep the jog control on the encoder, but make it so you have to press a button to pause the video before it will send the left right arrows.

Also you need to comment your code and give the pins sensible names. Currently it's impossible to understand what it does.

Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.... :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.