Hi Brandon again,
i wrote a function to find the surface.My logic is like that.
Black surface:2 sensors on the white line
1000 1000 0 0 1000 1000
white surface:2 sensors on the black line
0 0 1000 1000 0 0
this is my function to check surface..
total = 0;
average = 0;
for (int i = 0; i < NUM_SENSORS; i++)
total += sensorValues[i];
averge = total / NUM_SENSORS;
if (average< 333)//this is white surface
by the way in the loop I fixed my code like this.
unsigned int position = qtra.readLine(sensorValues,surface);
when i am on the black surface, my variable surface is 1, when i am on the white surface, my variable is 0. i checked that my function is working.
but position is not true when i was on the white surface. on the black surface everything is ok.
where can be the problem? according to me it is true but when i looked from the serial monitor, my problem continues..Thanks..