This is the source code for a one legged robot (2 servos) on an Arduino Mega 2560 R3. This is the student-friendly version.
This is a version of the One-Legged-Robot that I used in my STEM class. The students were able to help me select values to enter for the leg positions.