help in this project

helo im lokking for some one help me with my project hereis line following robot
all connection is right but ithink there areaprogramming proplem because the robotit only do the the last (else) whateve is it

help me with witing program

#include <AFMotor.h>

AF_DCMotor motor(1, MOTOR12_64KHZ);
AF_DCMotor motor2(4, MOTOR34_64KHZ);

int sensorpin1=50;
int a = 0;

int sensorpin2=48;
int b = 0;

int sensorpin3=46;
int c = 0;

void setup() {
motor.run(FORWARD);
motor2.run(FORWARD);
Serial.begin(9600);
}

void loop()
{

a=digitalRead(sensorpin1);
b=digitalRead(sensorpin2);
c=digitalRead(sensorpin3);
Serial.println(c);

if( a==1 && b==0 && c==1 )
{
motor.setSpeed(130);
motor2.setSpeed(130);
}

else if (a==0 && b==1 && c==1)
{
motor.setSpeed(130);
motor2.setSpeed(120);
}
else if (a==1 && b==1 && c==0)
{
motor.setSpeed(120);
motor2.setSpeed(130);
}
else {
motor.run(BACKWARD);
motor2.run(BACKWARD);
}
}

But how do you know what the values of a and b are? You're only printing c.

Then you should also put prints inside the legs of the ifs, to see where it's actually going.

nevermind about what i printed it just for test the sensors work

Yeah? So print all three and then you will know for a fact which leg of the "if" it should go to. Then as I already suggested, put prints inside the legs of the "if" and see where it actually goes.

Might need a delay at the bottom while you test so you can read the screen.

faiselfaiq: nevermind about what i printed it just for test the sensors work

Not a very nice response to someone who is trying to help you.

...R