Problem line follower

Hey,

I’m trying to Program line follower
Here is the task
There are two zones (As the photo)
Zones A - Black line on the white surface
Zone B - White line on the black surface

I programmed zone A correctly. the Robot move correctly on the line
But I cannot program the robot move to zone A to zone B

please help me to program this.

Here is my code

int rightF=22,rightR=24,leftF=26,leftR=28;
int spcR=12,spcL=11;
int inR1=40,inR2=38,inR3=36,inR4=34;
int inC=42;
int inL1=46,inL2=44,inL3=50,inL4=48;
int B;
int W;
int i=0;
void setup() {
pinMode( rightF, OUTPUT);
pinMode( rightR, OUTPUT);
pinMode(leftF, OUTPUT);
pinMode(leftR, OUTPUT);
pinMode(spcR, OUTPUT);
pinMode(spcL, OUTPUT);
pinMode(inL1, INPUT);
pinMode(inR1, INPUT);
pinMode(inL2, INPUT);
pinMode(inR2, INPUT);
pinMode(inL3, INPUT);
pinMode(inR3, INPUT);
pinMode(inC, INPUT);
pinMode(inL4, INPUT);
pinMode(inR4, INPUT);

}

void loop(){
int inL1r=digitalRead(inL1);
int inR1r=digitalRead(inR1);
int inL2r=digitalRead(inL2);
int inR2r=digitalRead(inR2);
int inL3r=digitalRead(inL3);
int inR3r=digitalRead(inR3);
int inL4r=digitalRead(inL4);
int inR4r=digitalRead(inR4);
int inCr=digitalRead(inC);

B=LOW;
W=HIGH;

if (inL3r==B && inL2r==B && inL1r==B && inCr==B && inR1r==B && inR2r==B && inR3r==B)
{GoFast(); }

if (inL3r==W && inL2r==W && inL1r==W && inCr==B && inR1r==W && inR2r==W && inR3r==W)
{ GoFast();}

if (inL1r==B && inR1r==W)
{samllTurnsLEFT();}

if (inL1r==W && inR1r==B)
{samllTurnsRIGHT();}

if (inL2r==B && inR1r==W && inR2r==W)
{largeTurnsLEFT();}

if (inR2r==B && inL1r==W && inL2r==W)
{largeTurnsRIGHT();}

if (inL4r==B && inL3r==B && inCr==B && inR3r==W && inR4r==W)
{
delay(300);
Turn90LEFT();}
if (inL4r==W && inL3r==W && inCr==B && inR3r==B && inR4r==B)
{
delay(300);
Turn90RIGHT();
}

}

void GoFast(){
digitalWrite(rightF,HIGH);
digitalWrite(rightR,LOW);
digitalWrite(leftF,HIGH);
digitalWrite(leftR,LOW);
analogWrite(spcL,255);
analogWrite(spcR,235);
}

void GoSlow(){
digitalWrite(rightF,HIGH);
digitalWrite(rightR,LOW);
digitalWrite(leftF,HIGH);
digitalWrite(leftR,LOW);
analogWrite(spcL,50);
analogWrite(spcR,30);}

void samllTurnsRIGHT(){
analogWrite(spcL,255);
analogWrite(spcR,195);
digitalWrite(rightF,HIGH);
digitalWrite(rightR,LOW);
digitalWrite(leftF,HIGH);
digitalWrite(leftR,LOW);
}

void samllTurnsLEFT(){
analogWrite(spcL,195);
analogWrite(spcR,235);
digitalWrite(rightF,HIGH);
digitalWrite(rightR,LOW);
digitalWrite(leftF,HIGH);
digitalWrite(leftR,LOW);}

void largeTurnsRIGHT(){
analogWrite(spcL,200);
analogWrite(spcR,25);
digitalWrite(rightF,HIGH);
digitalWrite(rightR,LOW);
digitalWrite(leftF,HIGH);
digitalWrite(leftR,LOW);
}

void largeTurnsLEFT(){
analogWrite(spcL,45);
analogWrite(spcR,180);
digitalWrite(rightF,HIGH);
digitalWrite(rightR,LOW);
digitalWrite(leftF,HIGH);
digitalWrite(leftR,LOW);
}

void Turn90RIGHT(){

for (int time=0; time<250; time++)
{ digitalWrite(rightF,LOW);
digitalWrite(rightR,HIGH);
digitalWrite(leftF,HIGH);
digitalWrite(leftR,LOW);
analogWrite(spcL,255);
analogWrite(spcR,190);
delay(1);}
}
void Turn90LEFT(){

for (int time=0; time<350; time++)
{digitalWrite(rightF,HIGH);
digitalWrite(rightR,LOW);
digitalWrite(leftF,LOW);
digitalWrite(leftR,HIGH);
analogWrite(spcL,190);
analogWrite(spcR,230);
delay(1);}
}

void Turn180(){

for (int time=0; time<700; time++)
{ digitalWrite(rightF,HIGH);
digitalWrite(rightR,LOW);
digitalWrite(leftF,LOW);
digitalWrite(leftR,HIGH);
analogWrite(spcL,250);
analogWrite(spcR,230);}
}

void stopp(){
for (int r=0; r<500; r++)
{analogWrite(spcL,0);
analogWrite(spcR,0);
digitalWrite(rightF,LOW);
digitalWrite(rightR,LOW);
digitalWrite(leftF,LOW);
digitalWrite(leftR,LOW);
delay(1);
}}

But I cannot program the robot move to zone A to zone B

Why not? The improperly posted, piss-poorly indented code does something. What does it ACTUALLY do? What happens when you get to the transition?

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. And use the Auto Format feature to indent your code properly so it is more easily read.

…R