phase determination for optical shaft encoder


I have an optical shaft encoder and would like to determine the direction of motion. Finding the absolute distance can be done with a call to getEncoder(), and that works fine. However, I don’t see a way to determine the relative phase of the two inputs using EasyC. I don’t have mplab. :frowning:

Is there a way to do this using EasyC?

I would like to have the encoder attached to two “free” wheels, rather than attached to a shaft with a motor on it. The reasoning: if we are bumped and the robot skids backwards, the free wheels will spin but the wheels attached to the motors won’t. (Thus the motors cannot necessarily be used to determine direction in this case.) Last year we were bumped in our autonomous mode and dumped all of our tennis balls … in the opponent’s trough. :eek: We’d like to avoid that this year…

:slight_smile: jen

…nevermind… EasyC Pro has a function for that purpose. That’ll teach me to use the regular version… sorry :stuck_out_tongue: jen