Need help for functions using the line follower

I am doing a project in which the robot has to travel on white space for some distance , and identify the line by itself and follow the line …
i even need to pick some balls lying in its surroundings …
i odered a qtr-8rc line sesnor array . i thought it was a normal digital sensor which gives either 0 or 1 as output after detecting the line .but this sensor seems to be complicated
can any one help me in finding the line from its initial position

the track area is 7 ft X 7 ft with a circular path exatly in the center with diameter of 57 "


You can see how you might implement line following by looking at the two examples under “Reading the Sensors” and “PID Control” headings of the “QTRSensors Methods & Usage Notes” section of the “Arduino Library for the Pololu QTR Reflectance Sensors”, which is located under the “Resources” tab of the QTR-8RC Sensor Array product page.


Thanks Derril

i looked at the QTRSensors Methods & Usage Notes page .

i my model i am using a Qtr 8rc line sensor array for following the line and along with that i would be using 4 x Qtr -1rc sensors to detect a hole exactly on the line
so can i use two instances for declaring the Qtr sensors . one with 6 sensors and other with 4 sensors

as it was said in the notes

But i wanted to use the digital version of the sensor

so …now how should i declare for the 2 sensor arrays (both digital)


The QTR-8RC is not really a digital sensor and does not output just a digital high and low, and we do not have a version of this sensor that does. Instead, the QTR-8RC uses a microcontroller’s digital pins to time how long it takes the sensor’s output voltage to decay due to the integrated phototransistor. A shorter decay time is an indication of greater reflection.

Our library takes care of the differences between the QTR-xA and QTR-xRC sensors internally, providing you with a common interface to both sensors. The only external difference is in the constructors, as you can see in this code sample for instantiating the QTR-xRC object :

// create an object for four QTR-xRC sensors on digital pins 0 and 9, and on analog
// inputs 1 and 3 (which are being used as digital inputs 15 and 17 in this case)
QTRSensorsRC qtrrc((unsigned char[]) {0, 9, 15, 17}, 4);

The first argument to the QTRSensorsRC constructor is an array of digital pins (0–19). Note that analog inputs 0 – 5 can be used as digital pins 14 – 19. For more details, see the"QTRSensors Methods & Usage Notes" section of the “Arduino Library for the Pololu QTR Reflectance Sensors.pdf”, which is located under the “Resources” tab of the QTR-8RC Reflectance Sensor Array product page.

I suggest getting one sensor working first before trying to use two instances of the QTRSensorsRC class. If you have trouble writing your own code to control the sensor, I recommend using our Arduino raw values example code to make sure you have everything connected correctly.