Interesting. I agree on only looking for the CW or CCW change. I am thinking of an "enhancement." My thought was to use those returns that indicate more than a 1-bit change as flags to change the range. MrAL has a recent thread wherein he uses a switch to do the same thing. My thought was to use a missed read for the same purpose. MrAL used the term acceleration, but I just think of it as velocity.
John
Hi there John,
Yeah i call it acceleration because there is a change in the speed (speed=abs(velocity)) not just a change in the distance or numerical value.
Say we have an encoder that can spit out a number from 1 to 100 when we turn it clockwise. We might see this sequence come out:
1,2,3,4,5,...
Now if we are turning it one click per second we get 1, then a second later 2, then a second later 3, etc. This means we are turning it at the rate of 1 click per second, which is speed (or velocity), and for simplicity the program interprets that as 1 click per second and accumulates that as a total count N. Now if we keep turning it for let's say 5 seconds non stop, the program detects that and starts increasing the value of one click, lets say from 1 (before) to 2 (after). Now still turning it 1 click per second, the program interprets this as 2 clicks per second, and thus increasing the count by 2 per second. That is the same as an increase in the speed itself and that means it is really more like velocity. So the clicks for this example would accumulate as:
1,2,3,4,5,7,9,11,13,15,17
and we can see that we started out as accumulating 1 per second until we got to 5 and then we switched to 2 per second.
If we take the derivative we get the acceleration, so i guess this is why it is actually referred to as acceleration (i didnt make this up, that's what it is actually referred to in literature).
If you feel more comfortable calling it velocity im sure that's not a problem unless you see written somewhere something about an acceleration table or list of accelerators. The list is used to determine the times to change the speed. For example, a list like this:
{{5,2},{7,5},{10,20}}
would mean switch to 2 per second after 5 seconds, then switch to 5 per second after 7 seconds, then switch to 20 per second after 10 seconds.
If the user ever stops rotating the control, the sequence starts all over again at 1 per second, then after 5 seconds it increases again to 2 per second, etc.