I'd like to build a robotic arm...

I think the sweep tutorial should do to start you off:

That one uses pin 9 but I guess you can change it to whatever PWM pin you like. I might add in a couple of LED indicators to indicate when the servo is sweeping one way or the other, to see if the code is working in situ.