Arduino

Buy | Download | Getting Started | Learning | Reference | Hardware | FAQ

Blog » | Forum » | Playground »

Reference Language (extended) | Libraries | Comparison | Board

## Servo library

This library allows an Arduino board to control one or two RC servo motors. These have integrated gears and a shaft that can be positioned at a various angles, usually between 0 and 180 degrees. This library can control servos with pins 9 and 10. If only one servo is used, the other pin cannot be used for normal PWM output with analogWrite(). For example, you can't have a servo on pin 9 and PWM output on pin 10.

#### Circuit

Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow or orange and should be connected to pin 9 or 10 on the Arduino board.

#### Functions

- attach()
- write()
- read()
- attached()
- detach()

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Edit Page | Page History | Printable View | All Recent Site Changes