V. Electronics and Software

Since I have prior experience with programming an Arduino, as well as experience with servo motors, I decided to use both in my mechanism. I did not take into account the fact that servo motors can only rotate between 0 and 180 degrees when designing my mechanism. I wrote the code so that my servo motor would rotate 180 degrees from 90 degrees to -90 degrees. This had little effect on the motion for my mechanism but the slider's hole that I created was a bit longer than needed, due to the limited motion. Figure 1 shows the connection used to power my motor, while Figure 2 shows the code to control the motor's rotation.


Figure 1. Servo Motor and Arduino Connection


Figure 2. Motor Control Code