Servo library

This library allows an 86Duino 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 Servo library supports up to 45 motors on 86Duino boards, and has an improved implementation, in contrast with the original Servo library of Arduino Uno and Mega 2560, to generate stable servo-command pulses no matter how many motors are controlled (see this page for more details). Note that use of the library disables analogWrite() (PWM) functionality, whether or not there is a Servo on those pins.

Circuit

Servo motors have three wires: power, ground, and signal. The power wire is typically red, and, in the case of 5V-powered servo motors, may be connected to the 5V pin on the 86Duino board. The ground wire is typically black or brown and should be connected to a ground pin on the 86Duino board. The signal pin is typically yellow, orange or white and should be connected to a digital pin on the 86Duino board. Note that servos draw considerable power, so if you need to drive more than one or two, you’ll probably need to power them from a separate supply (i.e. not the +5V pin on your 86Duino). Be sure to connect the grounds of the 86Duino and external power supply together.

Functions

attach()
write()
writeMicroseconds()
read()
attached()
detach()

Limits

The Servo library employs the internal timer that are also used by both the TimerOne and Servo86 libraries; so to avoid conflicts, one should avoid calling these libraries at the same time.

Examples

The following are examples of the Servo library from the Arduino Tutorial that can work on the 86Duino boards:

Knob: control the shaft of a servo motor by turning a potentiometer.
Sweep: sweeps the shaft of a servo motor back and forth.


DEMO VIDEO


Libraries Reference Home

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