User Manual

The destructor for the QTRSensors class frees up memory allocated for the calibration arrays.
Constructor: QTRSensorsRC()
This version of the constructor performs no initialization. If it is used, the user must call init() before
using the methods in this class.
Constructor: QTRSensorsRC(unsigned char* digitalPins, unsigned char numSensors,
unsigned int timeout = 2500, unsigned char emitterPin = QTR_NO_EMITTER_PIN)
This constructor just calls init(), below.
void QTRSensorsRC::init(unsigned char* digitalPins, unsigned char numSensors, unsigned int
timeout = 2500, unsigned char emitterPin = QTR_NO_EMITTER_PIN)
Initializes a QTR-RC (digital) sensor array.
The array digitalPins should contain the Arduino digital pin numbers for each sensor.
numSensors specifies the length of the digitalPins array (the number of QTR-RC sensors you are
using). numSensors must be no greater than 16.
timeout specifies the length of time in microseconds beyond which you consider the sensor reading
completely black. That is to say, if the pulse length for a pin exceeds timeout, pulse timing will stop
and the reading for that pin will be considered full black. It is recommended that you set timeout to
be between 1000 and 3000 us, depending on factors like the height of your sensors and ambient
lighting. This allows you to shorten the duration of a sensor-reading cycle while maintaining useful
measurements of reflectance.
emitterPin is the Arduino digital pin that controls whether the IR LEDs are on or off. This pin is
optional and does not exist on some of the QTR sensor arrays. If a valid pin is specified, the emitters
will only be turned on during a reading. If the value QTR_NO_EMITTER_PIN (255) is used, you can
leave the emitter pin disconnected and the IR emitters will always be on.
Constructor: QTRSensorsAnalog()
This version of the constructor performs no initialization. If this constructor is used, the user must
call init() before using the methods in this class.
Constructor: QTRSensorsAnalog(unsigned char* analogPins, unsigned char numSensors,
unsigned char numSamplesPerSensor = 4, unsigned char emitterPin =
QTR_NO_EMITTER_PIN)
This constructor just calls init(), below.
void init(unsigned char* analogPins, unsigned char numSensors, unsigned char
numSamplesPerSensor = 4, unsigned char emitterPin = QTR_NO_EMITTER_PIN)
Initializes a QTR-A (analog) sensor array.
Arduino Library for the Pololu QTR Reflectance Sensors © 2001–2018 Pololu Corporation
3. QTRSensors Methods & Usage Notes Page 10 of 15