User Manual
and even emitter pins. If wait is false, the function will return immediately instead of waiting until the
emitters actually turn on.
void emittersOff()
Turn the IR LEDs off. This is mainly for use by the read method, and calling these functions
before or after the reading the sensors will have no effect on the readings unless the readMode is
QTR_EMITTERS_MANUAL, but you may wish to use these for testing purposes.
void emittersOff(unsigned char bank, bool wait = true)
Dimmable only: This version of emittersOff() turns off the emitters for the specified bank, which is
either QTR_BANK_ODD or QTR_BANK_EVEN. It will only work if you have specified separate odd
and even emitter pins. If wait is false, the function will return immediately instead of waiting until the
emitters actually turn off.
void emitterBankSelect(unsigned char bank)
Dimmable only: This function turns on the selected bank (QTR_BANK_ODD or QTR_BANK_EVEN)
of emitters while turning off the other bank. It performs both of these operations at the same time
and waits for both banks of emitters to be in the right states before returning, but it eliminates
unnecessary delays that would happen if you called emitersOff() and emittersOn() separately. This
function will only work if you have specified separate odd and even emitter pins.
void setDimmingLevel(unsigned char dimmingLevel)
Dimmable only: Sets the dimming level for the emitters (0–31). A dimming level of 0 corresponds
to full current and brightness, with higher dimming levels meaning lower currents; see your sensor
board’s product page for details. The dimming level takes effect the next time emittersOn() is called
(which can happen in the read method). If the emitters are already on, you should call emittersOff()
before calling emittersOn() to apply the dimming level.
unsigned char getDimmingLevel()
Dimmable only: Returns the current emitter dimming level.
void calibrate(unsigned char readMode = QTR_EMITTERS_ON)
Reads the sensors for calibration. The sensor values are not returned; instead, the maximum
and minimum values found over time are stored internally and used for the readCalibrated()
method. You can access the calibration (i.e raw max and min sensor readings) through the public
member pointers calibratedMinimumOn, calibratedMaximumOn, calibratedMinimumOff, and
calibratedMaximumOff. Note that these pointers will point to arrays of length numSensors, as
specified in the constructor, and they will only be allocated after calibrate() has been called. If you
only calibrate with the emitters on, the calibration arrays that hold the off values will not be allocated.
void readCalibrated(unsigned int *sensorValues , unsigned char readMode =
QTR_EMITTERS_ON)
Returns sensor readings calibrated to a value between 0 and 1000, where 0 corresponds to a
Arduino Library for the Pololu QTR Reflectance Sensors © 2001–2018 Pololu Corporation
3. QTRSensors Methods & Usage Notes Page 8 of 15