added button to switch encoder mode between speed and PWM duty cycle