This example shows how to control a servo by using the Servo component. You can find the diagram in the following figure.
For this example, it is recommended to use an external power source to provide voltage for the servo. This is because the power from the Arduino may not be sufficient. If you are unsure how to connect your servo, take a look at the reference in the Arduino Playground.
Servos are controlled with a signal in the range of 0 to 1, where 0 corresponds to 0 degrees of rotation and 1 to 180 degrees. This example makes the servo bounce from 0 to 180 degrees until it gets stable around 90 degrees.