User Manual
Stops Timer 1, sets all used servo pins as driving-low outputs, and frees up the memory that was dynamically
allocated by the servos_start() or servos_start_extended() function. If you want to use Timer 1 for some other
purpose, such as playing sounds using OrangutanBuzzer functions, you should call servos_stop() first. Servos
cannot be used after calling servos_stop() without first calling servos_start() or servos_start_extended() again.
static void OrangutanServos::setServoTarget(unsigned char servo_num , unsigned int pos_us)
static unsigned int OrangutanServos::getServoTarget(unsigned char servo_num)
static void OrangutanServos::setServoTargetB(unsigned char servo_num, unsigned int pos_us)
static unsigned int OrangutanServos::getServoTargetB(unsigned char servo_num)
void set_servo_target(unsigned char servo_num, unsigned int pos_us)
unsigned int get_servo_target(unsigned char servo_num)
void set_servo_target_b(unsigned char servo_num, unsigned int pos_us)
unsigned int get_servo_target_b(unsigned char servo_num)
These functions set and get a servo’s target position in units of microseconds. This is the pulse width that will
be transmitted eventually, but this pulse width may not be transmitted immediately if there is a speed limit set
for the servo, or if the target was changed within the last 20 ms. A position value of 0 turns off the specified
servo (this is the default). Otherwise, valid target positions are between 400 and 2450 us. The servo_num
parameter should be a servo number between 0 and 7 and should be less than the associated num_servos
parameter used in the servos_start() or servos_start_extended() function.
static void OrangutanServos::setServoSpeed(unsigned char servo_num, unsigned int speed)
static unsigned int OrangutanServos::getServoSpeed(unsigned char servo_num)
static void OrangutanServos::setServoSpeedB(unsigned char servo_num, unsigned int speed )
static unsigned int OrangutanServos::getServoSpeedB(unsigned char servo_num)
void set_servo_speed(unsigned char servo_num, unsigned int speed)
unsigned int get_servo_speed(unsigned char servo_num)
void set_servo_speed_b(unsigned char servo_num, unsigned int speed)
unsigned int get_servo_speed_b(unsigned char servo_num)
These functions set and get a servo’s speed limit in units of tenths of a microsecond per 20 ms. A speed value
of 0 means there is no speed limit. A non-zero speed value means that each time the library sends a servo
pulse, that pulse’s width will be within speed/10 µs of the previous pulse width sent to that servo. For example,
with a speed value of 200, the pulse width will change by at most 20 µs each time the library sends a pulse.
The library sends a pulse every 20 ms, so it will take 1000 ms (50 pulses) to change from a pulse width of
1000 µs to a pulse width of 2000 µs. The servo_num parameter should be a servo number between 0 and 7 and
should be less than the associated num_servos parameter used in the servos_start() or servos_start_extended()
function.
static unsigned int getServoPosition(unsigned char servo_num)
static unsigned int getServoPositionB(unsigned char servo_num)
unsigned int get_servo_position(unsigned char servo_num)
unsigned int get_servo_position_b(unsigned char servo_num)
These functions get a servo’s current position in units of microseconds. This is the last pulse width that was
transmitted to the servo, but this pulse width might not be equal to the target if there is a speed limit set for the
servo, or if the target has changed with the last 20 ms. This method does not rely on feedback from the servo,
so if the servo is being restrained or overly torqued or simply cannot physically move as quickly as the pulse
widths are changing, it might not return the actual position of the servo. If there is a speed limit set for this
servo, you can use this method to determine when the servo pulse signal has reached its desired target width.
The servo_num parameter should be a servo number between 0 and 7 and should be less than the associated
num_servos parameter used in the servos_start() or servos_start_extended() function.
Pololu AVR Library Command Reference © 2001–2015 Pololu Corporation
11. Orangutan Servos Page 44 of 65