Rotary encoders are used to electronically monitor the position of a rotating shaft by converting shaft rotation into electronic pulses.
The encoder’s output pulses are counted and evaluated by a control unit to determine machine position and velocity, which provides exceptional accuracy and flexibility when controlling motion.
The encoder is different from a potentiometer in that an encoder has full rotation without limits. The unit outputs gray code so that you can tell how much and in which direction the encoder has been turned.
Link to BildR Tutorials