User Manual
This constructor just calls init(), below.
void PololuQTRSensorsAnalog::init(unsigned char* analogPins, unsigned char numSensors, unsigned
char numSamplesPerSensor = 4, unsigned char emitterPin = 255)
void qtr_analog_init(unsigned char* analogPins, unsigned char numSensors, unsigned char
numSamplesPerSensor, unsigned char emitterPin)
Initializes a QTR-A (analog) sensor array.
The array pins contains the analog pin assignment for each sensor. For example, if pins is {0, 1, 7}, sensor 1
is on analog input 0, sensor 2 is on analog input 1, and sensor 3 is on analog input 7. The ATmegaxx8 has 8
total analog input channels (ADC0 – ADC7) that correspond to port C pins PC0 – PC5 and dedicated analog
inputs ADC6 and ADC7. The Orangutan SVP and X2 also have 8 analog input channels (ADC0 – ADC7) but
they correspond to port A pins PA0 – PA7. The analog channels provided by the Orangutan SVP’s auxiliary
processor (channels A, B, C, and D) are not supported by this library.
numSensors specifies the length of the analogPins array (the number of QTR-A sensors you are using).
numSensors must be no greater than 8.
numSamplesPerSensor indicates the number of 10-bit analog samples to average per channel (per sensor)
for each reading. The total number of analog-to-digital conversions performed will be equal to numSensors
times numSamplesPerSensor. Increasing this parameter increases noise suppression at the cost of sample rate.
Recommended value: 4.
emitterPin is the digital pin (see qtr_rc_init(), above) that controls whether the IR LEDs are on or off. This
pin is optional and only exists on the 8A and 8RC QTR sensor arrays. If a valid pin is specified, the emitters
will only be turned on during a reading. If an invalid pin is specified (e.g. 255), the IR emitters will always be
on.
Pololu AVR Library Command Reference © 2001–2015 Pololu Corporation
16. QTR Reflectance Sensors Page 57 of 65