i want to count each junction of line that my robot pass though, but this coding wont work.the counting was TOO fast and the robot didnt even start following the line....can anyone help me??urgent....
void line_follower2(unsigned int8 juncnum)
{
unsigned int i;
i = 0;
while(i<juncnum)
{
if ((input(IR1) == 0) && (input(IR2) == 0))
{
motor_direction(forward);
}
else if ((input(IR1) == 0) && (input(IR2) == 1))
{
motor_direction(small_left);
}
else if ((input(IR1) == 1) && (input(IR2) == 0))
{
motor_direction(small_right);
}
else if ((input(IR1) == 1) && (input(IR2) == 1))
{
i++;
}
}
}