Read the "How to use this forum - please read." at the top of the post. Post your code in code tags. A smoke detector 9v battery is really not adequate for powering servos. Below is a basic wiring setup for a servo.
I didn't post code, because I'm sure my code is is right (it's working from arduino, and I'd tried with your servo test code too
By the way, you were right with the battery. I've just hooked the servo to a 11.1v 5000mAh, 20C battery through a 7806 6V 1A regulator and two capacitors paralell, and it's working like a dream, so thank you for the help.
No, it's not exactly. I don't want the the arduino to power my servo.