Is this where you got the qtr library you are using?
It looks like you should be able to simplify your program greatly, which will probably help you locate the problem. For example, a good start would be to remove the calibration code entirely and to just print out the raw sensor readings. Also, I suggest that you disconnect the LEDON pin while you’re trying to get things working. When disconnected, the LEDs should be on 100% of the time. When connected, it just becomes another place where something could be going wrong (e.g. if you read the sensors with the LEDs off, you will generally see the maximum readings for all the sensors).
For example, can you just try something like:
#include <PololuQTRSensors.h>
#define NUM_SENSORS 6 // number of sensors used
#define NUM_SAMPLES_PER_SENSOR 4 // average 4 analog samples per sensor reading
// sensors 0 through 5 are connected to analog inputs 0 through 5, respectively
PololuQTRSensorsAnalog qtra((unsigned char[]) {0, 1, 2, 3, 4, 5},
NUM_SENSORS, NUM_SAMPLES_PER_SENSOR, QTR_NO_EMITTER_PIN);
unsigned int sensorValues[NUM_SENSORS];
void setup(){}
void loop()
{
qtra.read(sensorValues);
unsigned char i;
for (i = 0; i < NUM_SENSORS; i++)
{
Serial.print(sensorValues[i]); // I TOOK OUT THE MATH THAT CONVERTED THE NUMBER TO SOMETHING BETWEEN 1-9
Serial.print(' ');
}
delay(250);
}
Also, when you post code, please use the [ code ][ /code ] tags (minus the whitespace), or press the “Code” button so that it is formatted nicely, like my code above.
- Ben
