Thank you all, but this code uses a "virtual" pwm that isn't accurate and uses too cpu. I need to control two servo of a webcam so i need a stable solution! I've read that the Raspi has one or more hardware pwm https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=105044. There is a way to use it?
For servo controlling i use always the micro maestro servo controller from Pololu. I use it for camera control too for years without problems (but mid-size video cams no webcams), driving is stable and smooth (winch servos with 10 turns and 10:1 gear ratio).
The benefits:
Controlling is simple with serial interface from Arduino or Pi.
I can use it with PC also without the need of an microcontroller.
The servo controller can use ramping.