Go Down

Topic: Vex Optical Shaft Encoders (Read 3159 times) previous topic - next topic


Well, I've got all my Vex sensors and motors running flawlessly .... except the Optical Shaft Encoders. I think the stumbling block is simply that I'm not really sure how they are designed to operate.

I've read online about other rotary encoders but they seem to have some sort of internal counter whereas I don't believe the Vex model is that sophisticated.


So provide a link to the sensor you are using, post a diagram of how you have wired it up and post the code of how you are trying to read them saying what it does and what you would expect it to do.



The wiring seems trivial enough.

- Red to +5V
- Black to ground
- White to a digital port configured as Input.

As for the code I haven't the foggiest idea where to start as I don't clearly understand how the device is intended to operate.


Look at the inventors guide on their website for the encoder - explains how it works...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Arg!. Thanks. I missed the link.

It appears as if I have to constantly monitor the ports I attach it two and based on counting the pulses, calculate the distance, speed and direction traveled.

Yuck! I guess I was hoping that there was a more elegant way of using it than constantly monitoring a port every time through the loop.


You can use interrupts generated by the signals. There are examples in the playground.

Go Up