Please note that the blue positions use analog pins and can accommodate either QTR-1RC or QTR-1A sensors,
while the green positions use digital pins and are only suitable for QTR-1RC sensors. We generally recommend
using QTR-1RC sensors, as they tend to perform better than QTR-1A sensors at this mounting distance, and
QTR-1RC sensors work in all five depicted locations. To keep your Arduino code simpler, we recommend only
using one type of sensor (in other words, if you want to use a sensor in a green position, all of your sensors should
be QTR-1RC sensors).
For maximum compactness (e.g. to make better room for a front blade), the mounting hole portions of the QTR
sensor boards can be cut or ground off to make them smaller.
7.b. Arduino sketch
With the addition of QTR sensors, your Zumo should be able to drive around and stay within a sumo ring. The
following example sketch demonstrates how to program an Arduino-controlled Zumo to do this.
To begin, install the
[http://www.pololu.com/docs/0J57/6]
and our
Pololu QTR Reflectance Sensors
[http://www.pololu.com/docs/0J19]
.
Then,
download
and
open
[http://www.pololu.com/file/download/
ZumoBorderDetect.ino?file_id=0J593]
(2k ino) or copy the following code into a new sketch in the Arduino
environment:
#include <ZumoBuzzer.h>
#include <ZumoMotors.h>
#include <Pushbutton.h>
#include <QTRSensors.h>
#define LED 13
// these might need to be tuned for different lighting conditions, surfaces, etc.
#define QTR_A_THRESHOLD 900
#define QTR_RC_THRESHOLD 3800
Pololu Zumo Shield for Arduino User's Guide
© 2001–2012 Pololu Corporation
7. Example project: Border-detecting sumo robot
Page 26 of 28