This week I redid my program and made it shorter. I also moved my code from the loop to the setup because I only need it to run through once. I added a extension on my bread board so I could fit my voltage regulator in the circuit. The five volt regulator allows me to power my servo separately with a nine volt battery.
This is my circuit with the extra breadboard
This is my shortened code