Quote:
|
Originally Posted by Mike Betts
Pickle,
Use the Hall sensor as a digital input and interrupt on the rising edge.
I strongly suggest that you use Kevin Watson's RC encoder example as a guide. Just eliminate the part where he looks at the quadrature input to determine direction.
|
Instead of looking at the encoder phase-b signal, you could look at the motor's commanded direction and increment/decrement the counters as necessary. One problem that comes to mind, though, is what is sometimes the robot won't have a commanded direction when the interrupt fires off. You may be able to get around this by keeping track of the last commanded direction in a state variable.
-Kevin