A rotary encoder that outputs pulse trains in accordance with the rotation displacement of the shaft. Detect the amount of rotation by counting the number of pulses.