User Manual

Reference
C++ and Arduino methods are shown in red.
C functions are shown in green.
static unsigned char OrangutanServos::start(const unsigned char servo_pins[], unsigned char num_pins)
unsigned char servos_start(const unsigned char servo_pins[], unsigned char num_pins)
Configures the AVR’s Timer 1 module to generate pulses for up to 8 servos. The num_pins parameter should
be the length of the servo_pins array. A nonzero return value indicates that the needed memory could not be
allocated.
The servo_pins parameter should be the RAM address of an array of AVR I/O pin numbers defined using the
IO_* keywords provided by the library (e.g. IO_D1 for a servo output on pin PD1).
On the Orangutan SVP: this function takes an array of AVR pins that you have wired to the demux selection
pins. The length of the array should be 0–3. The number of servos you can control is 2
num_pins
. The servo
pulses are generated on pin PD5, which is a hardware PWM output connected to the input of the demux,
and servos should be connected to demux (servo port) outputs 0 2
num_pins
on the SVP. See the “Servo
Demultiplexer” portion of Section 4 of the Orangutan SVP users guide for more information.
On the other Orangutans: this function takes an array of AVR pins that you have connected to the signal
pins on your servos. The length of the array should be 0–8. Each pin controls one servo.
This function was previously called servos_init(). To maintain compatibility with older versions of the library,
servos_init() still exists, but use of servos_start() is encouraged.
Example
// Orangutan SVP: configure PD0 and PD1 to be demux inputs SA and SB,
// which generates servo pulses on demux pins 0 - 3
// All else: configure for two servo outputs on pins PD0 and PD1
servos_start((unsigned char[]) {IO_D0, IO_D1}, 2);
// C++: OrangutanServos::start((unsigned char[]) {IO_D0, IO_D1}, 2);
static unsigned char OrangutanServos::start(const unsigned char servo_pins[], unsigned char num_pins,
const unsigned char servo_pins_b[], unsigned char num_pins_b)
unsigned char servos_start_extended(const unsigned char servo_pins[], unsigned char num_pins, const
unsigned char servo_pins_b[], unsigned char num_pins_b)
Configures the AVR’s Timer 1 module to generate pulses for up to 16 servos. A nonzero return value indicates
that the needed memory could not be allocated. The servo_pins and num_pins parameters serve the same
purpose here as they do in the function above. The num_pins_b parameter should be the length of the
servo_pins_b array. The servo_pins_b parameter should be the RAM address of an array of AVR pin numbers
defined using the IO_* keywords provided by the library (e.g. IO_D1 for servo pulses on pin PD1). The pins
should be connected to the signal pins on your servos. If you don’t want this second set of servos, use a
num_pins_b value of 0 (and a servo_pins_b value of 0) or use the servos_start() function above. Similarly, if
you want to only use the second set of servos, you can use a num_pins value of 0 (and a servo_pins value of
0).
This function was previously called servos_init_extended(). To maintain compatibility with older versions of
the library, servos_init_extended() still exists, but use of servos_start_extended() is encouraged.
static void OrangutanServos::stop()
void servos_stop()
Pololu AVR Library Command Reference © 2001–2015 Pololu Corporation
11. Orangutan Servos Page 43 of 65