8. Controlling a servo
This section explains how to control a hobby
[https://www.pololu.com/category/23/rc-servos]
from
an Arduino Uno, Arduino Leonardo, or A-Star 32U4 Prime that is connected to the Zumo Shield.
The Arduino IDE includes a
[http://arduino.cc/en/Reference/Servo]
library that generates the pulses
needed to control an RC servo. However, this servo library conflicts with ZumoMotors in that both rely
on Timer 1. Instead, you will need to do something special to get servo control working.
To control a servo with an Arduino Uno, see
. To control a servo with an Arduino Leonardo
or A-Star 32U4 Prime, see
.
8.a. Controlling a servo with an Arduino Uno
The example Arduino Uno code below shows how to control a single servo using Timer 2. Because it
uses Timer 2 instead of Timer 1, this code does not interfere with ZumoMotors, but it will interfere with
ZumoBuzzer, so you will not be able to use this and the buzzer at the same time. You can integrate
this code with other code that drives the motors.
Pololu Zumo Shield for Arduino User’s Guide
© 2001–2019 Pololu Corporation
8. Controlling a servo
Page 49 of 52