|
Re: Keeping track of Encoder Shaft Location using WPI Counter VI
I actually think my early morning quick-fix didn't fix. Taking a step back, it feels to me like you want three pieces of state data.
1. Last counter value -- used to compute delta, and updated to new counter value each call.
2. Number of forward counts
3. Number of backward counts
The button is used to determine whether the new delta is added to the Fwd or Bkwd state data.
The return value is the Fwd - Bkwd counts.
Perhaps you can do it with less, state, but to me, this seems the most natural way to think of it.
Hope that helps.
Greg McKaskle
|