Left hand rule Arduino robot

We are urgently programming a robot to solve the maze by using the left hand wall, we are using on ultrasonic sensor in front on the Arduino robot and 2 sharp infrared sensor on the side on the robot, but we are facing problem with programming, if any help please ?!!! I would be gratful. Thank you

What problems ? What have you coded so far ?

#include <Servo.h>
Servo left;
Servo right;

const int TrigPin = 2;
const int EchoPin = 3; //定义SR04引脚

int Sensor_L=A0;
int Sensor_R=A5;
float da;
float dl;
float val=0;
char IR;

void setup()
{

Serial.begin(115200);
//初始化串口 定义舵机和SR04引脚
left.attach(10);

right.attach(11);

pinMode(TrigPin, OUTPUT);

pinMode(EchoPin, INPUT);

left.write(90);

right.write(90);

//小车初始化 停止 头朝前看

delay(1000);
}

float detect_forward_distance()
{
digitalWrite(TrigPin, LOW);
delayMicroseconds(2);
digitalWrite(TrigPin, HIGH);
delayMicroseconds(10);
digitalWrite(TrigPin, LOW);
float Fdistance = pulseIn(EchoPin, HIGH);
Fdistance= Fdistance/5.8/10;
Serial.print(“F distance:”);
Serial.println(Fdistance);
return Fdistance;
}
float detect_left_distance()
{
int Val;
IR=read_ir_range();
delay(500);
}
float read_ir_range()
{
float tmp;
tmp=analogRead(A0);
Serial.println(tmp);
return tmp;
}

void loop()
{

float da=detect_forward_distance();
float dl=detect_left_distance();

// normal good possible
if(250<dl<500&&da>20)
{
left.write(45);

right.write(111);

delay(500);
}

// the first processible
if(dl>1000&&da>20)
{
left.write(90);

right.write(111);// turm little right
delay(100);
da=detect_forward_distance();
if(da<5)//!!!1
{
left.write(90);

right.write(90);
// stop
delay(100);
dl=detect_left_distance();
if(250<dl<1000)
{
left.write(180);

right.write(90);//!!!!!here is wrong maybe,do not know how to turn little left
da=detect_forward_distance();
if (da>20)
{
left.write(45);

right.write(111);

}
}
else if(da>20)
{
left.write(45);

right.write(111);

}
}

// the second processible
if (da>20&&dl<200)// da is ok but dl is too big
{
left.write(180);

right.write(90); //maybe wrong !!!
delay(100);
da=detect_forward_distance();
if(da<5)// !!! need check on the maze
{
left.write(90);

right.write(90);
// stop
delay(100);
dl=detect_left_distance();
if(250<dl<1000)
{
left.write(90);

right.write(111); //turn little right maybe wrong!!!
da=detect_forward_distance();
if (da>20)// da is ok, can go
{
left.write(45);
right.write(111);
// go forward
}
}
else if(da>20)// da is ok
{
left.write(45);

right.write(111);
// go forwad
}
}

// the first corner
if (da<20&&250<dl<500)
{
left.write(0);

right.write(0);

delay(200);
}

// the second corner possible
if (da<15&&dl<250)
{
left.write(90);

right.write(90);// stop
delay(500);
left.write(180);

right.write(180);
//turn left
delay(100);
da=detect_forward_distance();
if (da<15)
{
if(dl<250)
{
left.write(180);

right.write(180);
//turn left
dl=detect_left_distance();
}
}
}
}
}
}

float detect_left_distance()
{
  int Val;
  IR=read_ir_range();
  delay(500); 
}

Call me old-fashioned, but you promised you'd return a value, but didn't.

And code tags. Yeah, I'm really old-fashioned about those too.

if (da<20&&250<dl<500)

Can you explain what that line does?
(And no, it almost certainly doesn’t)

da is the distance between the IR and the left wall and dl is the distance between wall and ultrasonic ?!!
if it is uncorrect, i dont have an experience in the code?!!
how can i make it naviagte by using the left-hand rule !?!! can you help me with this !?!1

You don't know what the value of "dl" is, because the function, as I pointed out, doesn't return a value.

Please turn your keyboard over and give it a good shake, because it looks like your ? and your ! keys aren't working properly.

if (da<20&&250<dl<500)

Should be written if ( da < 20 && dl > 250 && dl < 500)(you should be able to figure out the rest)

But first, you need to fix that function.