I picked up a really nice quadrature optical rotary encoder without detents and I have a project I want to use it on.
The project is a controller for a DC motor and I want 2 modes. Mode 1 where rotating the encoder increases and decreases the speed. This is straight forward.
Mode 2 is trickier and acts a bit like a jog command. Turning the encoder slowly will advance the motor slowly for a short time, turning it fast will advance the motor quicky, but also for a short time. It's like by turning the encoder you are fighting against gravity/friction.
The idea I had for Mode 2 was to implement a virtual 'spring' which effectively fights against you by reducing the speed value (that you increased by turning the encoder), always returning it to zero.
I thought this 'force' could be simulated with time using the **millis** command, but I have no idea how to go about it. Or even if there is a rotary encoder library that already offers this functionality.
Any help would be greatly appreciated.
Thanks in advance,
Dax Liniere
The project is a controller for a DC motor and I want 2 modes. Mode 1 where rotating the encoder increases and decreases the speed. This is straight forward.
Mode 2 is trickier and acts a bit like a jog command. Turning the encoder slowly will advance the motor slowly for a short time, turning it fast will advance the motor quicky, but also for a short time. It's like by turning the encoder you are fighting against gravity/friction.
The idea I had for Mode 2 was to implement a virtual 'spring' which effectively fights against you by reducing the speed value (that you increased by turning the encoder), always returning it to zero.
I thought this 'force' could be simulated with time using the **millis** command, but I have no idea how to go about it. Or even if there is a rotary encoder library that already offers this functionality.
Any help would be greatly appreciated.
Thanks in advance,
Dax Liniere