Electronics and Software

To better control the speed of the input crank, I used a potentiometer to quickly adjust the speed of the mechanism. I connected the potentiometer, a motor, and H-Bridge to the Arduino. My setup is shown below

Electronics Setup

The software for this setup is located in the Appendix. 

The potentiometer sends signals with a value between 0 and 1024, a ten bit signal, but the motor only reads 8-bit signals. To accommodate for this, the potentiometer signals are offset by 512 and divided by 2 so that the potentiometer sends signals between -255 and 255. This is so that the sign of the signal will change the direction of the rotation of the motor and the magnitude of the signal will change the magnitude of the speed of the motor.