This code allows you to calculate the rpm of the motor using a quadrature encoder. The rpm value will be displayed in the serial monitor, minus sign will represent the opposite direction of rotation. For code to work you must know the pulse per rotation of the encoder. If not known it can be calculated using this code. Distance travelled by the wheel is also being calculated, it can be uncommented and displayed on the serial monitor.