DC motor speed and direction of rotation using Arduino, rotary encoder and L293D motor driver. The rotary encoder has 5 pins: GND, +, SW, pin B and pin A.