User Manual

11. Orangutan Servos
This section of the library provides the ability to control up to 16 servos by generating digital pulses directly from
your Orangutan without the need for a separate servo controller. These servo control functions are non-blocking;
pulses are generated in the background by an interrupt while the rest of your code executes. Required memory
is allocated by the servos_start() or servos_start_extended() functions using malloc(), which conserves RAM.
The servos_stop() function frees this dynamically allocated memory.
This section of the library uses the AVR’s Timer 1 and several interrupts: TIMER1_CAPT, TIMER1_COMPA
(not used on the Orangutan SVP), and TIMER1_COMPB.
For a higher-level overview of how servo control works and how the library works on the different Orangutan
models, see Section 3.i of the Pololu AVR C/C++ Library Users Guide [https://www.pololu.com/docs/0J20].
Note: The OrangutanServos and OrangutanBuzzer libraries both use Timer 1, so they cannot
be used together simultaneously. It is possible to alternate use of OrangutanBuzzer and
OrangutanServos routines, however. The servos-and-buzzer example program shows how this
can be done and also provides functions for playing notes on the buzzer without using Timer 1
or the OrangutanBuzzer functions. The servo-control-using-delays example shows how to
generate servo pulses using delays rather than Timer 1 and the OrangutanServos functions.
Pololu AVR Library Command Reference © 2001–2015 Pololu Corporation
11. Orangutan Servos Page 42 of 65