Arduino - Servo Library


This library allows an Arduino board to control RC (hobby) servo motors. Servos have integrated gears and a shaft that can be precisely controlled. Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees. Continuous rotation servos allow the rotation of the shaft to be set to various speeds.

The library was included in Arduino IDE. It can be used without the need to install the library.

Servo Motor Pinout

Function References

Arduino Servo Motor Wiring Diagram

This image is created using Fritzing. Click to enlarge image

Example of Servo Motors

The library works with all standard servo motors. For example:

Please note: These are Amazon affiliate links. If you buy the components through these links, We will get a commission at no extra cost to you. We appreciate it.


This library is compatible with the avr, megaavr, sam, samd, nrf52, stm32f4, mbed architectures so you should be able to use it on the following Arduino boards:


  • The Servo library supports up to 12 motors on most Arduino boards, 48 on the Arduino Mega, and 60 on the Arduino Due .
  • On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins.
  • On the Mega, up to 12 servos can be used without interfering with PWM functionality; use of 12 to 23 motors will disable PWM on pins 11 and 12.


Arduino UNO R3
Arduino Starter Kit