Optical Shaft Encoder

I am currently working on the suqare bot through the Carnegie Mellon curriculum and need some help with the optical shaft encoder. I am currently using robotc for programing software. I have my two drive motors plugged into output 2 and 3 in the motor bank. My optical shaft encoders are plugged into input2 and 3 and interupt 5 and 6. After downloading the program following the curriculum which tells the robot to travel in a straight line for 5 rotations, the robot never stops. Do I have my interupts and inputs correct? Is my program just off? Can someone help me?

You may have your optical shaft encoders backwards, I think to flip them you can switch which plug is in the input and which one is interrupt ports, if I am wrong someone please correct me. But go ahead and try that, and if not, you can multiply the encoder’s values in-code by -1, to reverse them.

Good luck,
~Jordan

Could we see some of the program?
Thanks!

Thanks for posting. After looking at the program I had a < sign switched out for a > sign. The problem is all fixed. On the other hand, is there a reason why the motors all turn on for a split second when I turn on the robot?

Glad to hear your problem was resolved. And yes, that is normal, I am not exactly sure why, but it happens every time I turn on the robot as well.