The Vernier Rotary Motion Sensor is a bidirectional angle sensor designed to measure rotational or linear position. It is commonly used to study rotational dynamics, angular momentum, and the period of a pendulum. It produces a pulse on one digital line when it rotates one direction and on another line when it rotates in the other direction. To keep track of the motion of the Rotary Motion Sensor, you can simply tally pulses in each direction.
The Rotary Motion Sensor should be connected to the Digital 1 port on the Vernier Arduino Interface Shield or a Digital Protoboard Adapter wired to Arduino pins 2, 3, 4, and 5 as explained in the Connecting Vernier Sensors to the Arduino Using a Breadboard section. The VernierLib library does not support the Rotary Motion Sensor, but the sample sketch, VernierTutorialRotaryMotion, tallies the motions in both directions and reports the result every half second.
The pulses that the Rotary Motion Sensor generates are very short. To detect and count them accurately, you need to use “interrupt lines.” Using an interrupt frees the microcontroller to do other tasks while not missing an input from the rotary encoder. (For more information on Arduino interrupts see: http://arduino.cc/en/Reference/AttachInterrupt)
It is useful to know that the Vernier Rotary Motion Sensor can take data in either of two modes. In Normal resolution mode, it measures an angle to the nearest degree. In High-Resolution mode, the Rotary Motion Sensor measures an angle to one quarter of a degree. The VernierTutorialRotaryMotion sketch defaults to Normal resolution, but you can switch to High-Resolution by changing the variable highResOn to True.