Programming instructions

accessories
sensor accessories
Optical Shaft Encoder Kit, continued
Optical Shaft Encoder Kit • 4
For More Information, and additional Parts & Pieces refer to:
www.VexRobotics.com
With the Quadrature Encoder, you will use both outputs (Channel 1 and
Channel 2) to determine of the direction of rotation. The channels are
separated in phase by 90 degrees as shown below.
For example, if channel 1 leads channel 2, the wheel is rotating clockwise.
Likewise, if channel 2 leads channel 1, the wheel is rotating counter-
clockwise. By monitoring the relative phase and number of pulses of
channel 1 and 2, you can determine how fast, how far, and what direction
your robot is traveling.
Reprogramming your microcontroller to read the sensor
You’ll need to plug your shaft encoder into any port in the Interrupt bank on
the Vex Microcontroller. Depending on your specific application, you may be
able to use any port in the Analog/Digital bank. Note that the connector is
keyed to fit into the microcontroller port in a specific orientation; plugging it
in backwards could damage or even destroy your sensor.
In order for your robot to be able to read the sensor, you will have to
reprogram the microcontroller. Sample code to help you get started is
available on the Vex website.
2
Channel 1
Channel 2
90°
Go to Reference Links