need help in my code

i have write this program to manage a traffic light depending in IR Sensor
i use finite state machine , i used 4 states

1-no cars when the two ir sensors generate logic 0
in this state the traffic lights will behave like classic traffic light

2-lane 1: when first sensor generate logic 1 & second sensor generate logic 0
in this state the traffic lights make first road Green and second road Red

3-lane 2 : when second sensor generate logic 1 & first sensor generate logic 0
in this state the traffic lights make second road Green and first road Red

4-both : when first and second IR sensor generates logic 1
in this state the traffic lights will behave like classic traffic light

but the program behave like a classic traffic light in every states

i need help in my code

#include <FiniteStateMachine.h>

const int ph1=2;//the first photo sensor in lane1
const int ph2=3;//the second photo sensor in lane2
int red1=10;// the first red lamp for stopping lane1 motion
int green1=11;//the first green lamp for starting lane1 motion
int red2=12;//the second red lamp for stopping lane2 motion
int green2=13;//the scond green lamp for starting lane2 motion


//initialize states
State NO = State(Handle_NO_State);
State LANE1 = State(Handle_LANE1_State);
State LANE2 = State(Handle_LANE2_State);
State BOTH = State( Handle_BOTH_State);

FSM traffic = FSM(NO);     //initialize state machine, start in state: NO

void setup()
{
  pinMode(ph1,INPUT);
  pinMode(ph2,INPUT);
  pinMode(red1,OUTPUT);
  pinMode(green1,OUTPUT);
  pinMode(red2,OUTPUT);
  pinMode(green2,OUTPUT);


}
void loop()
{
     if (ph1==0&&ph2==0)
    {
	    traffic.transitionTo(NO);

    }
    else if (ph1==1&&ph2==0)
  {
    traffic.transitionTo(LANE1);
  }
    else if (ph1==0&&ph2==1)
  {
    traffic.transitionTo(LANE2);
  }
 else if (ph1==1&&ph2==1)
  {
    traffic.transitionTo(BOTH);
  }
  traffic.update();
 }

   
 void Handle_LANE1_State()
  {
  
    digitalWrite(red2,HIGH);//red2 HIGH to stop lane2 motion
    digitalWrite(green2,LOW);//green2 HIGH
    digitalWrite(red1,LOW);//red1 low to end lane1 stopping
    digitalWrite(green1,HIGH);//starting motion on lane1
   
  }
void   Handle_LANE2_State()
 {
   
  digitalWrite(red1,HIGH);//red1 high 2 stop motion on lane1
  digitalWrite(green1,LOW);//indicate not to move
  digitalWrite(red2,LOW);//move indication
  digitalWrite(green2,HIGH);//starting lane2 motion
}
 
  void Handle_BOTH_State()
  {
  
   digitalWrite(red1,LOW);//starting motion on lane1
  digitalWrite(green1,HIGH);//indicates starting motion
  digitalWrite(red2,HIGH);//prevent motion on lane2
  digitalWrite(green2,LOW);//indicates no motion on lane2
  delay(3000);
  digitalWrite(red2,LOW);//starting motion on lane2
  digitalWrite(green2,HIGH);//indicates motion on lane2
  digitalWrite(red1,HIGH);//prevent motion on lane1
digitalWrite(green1,LOW);//indicates no motion on lane1
delay(3000);
   
  }
   void Handle_NO_State()
  {
  
   digitalWrite(red1,LOW);//starting motion on lane1
  digitalWrite(green1,HIGH);//indicates starting motion
  digitalWrite(red2,HIGH);//prevent motion on lane2
  digitalWrite(green2,LOW);//indicates no motion on lane2
  delay(3000);
  digitalWrite(red2,LOW);//starting motion on lane2
  digitalWrite(green2,HIGH);//indicates motion on lane2
  digitalWrite(red1,HIGH);//prevent motion on lane1
digitalWrite(green1,LOW);//indicates no motion on lane1
delay(3000);
   
  }

You aren't reading the state of the digital inputs. In this code:

const int ph1=2;//the first photo sensor in lane1
const int ph2=3;//the second photo sensor in lane2

you declare ph1 and ph2 to be pin numbers but in this code (and what follows)

     if (ph1==0&&ph2==0)

you seem to assume that ph1 and ph2 are now the states of the pins rather than the pin numbers. ph1 is 2 and ph2 is 3 so ph1==0 and ph2==0 are always false. Instead of ph1==0 you should use digitalRead(ph1)==0 and similarly for ph2 in each if statement.

I'm not sure that things are going to work too well with those long delays in the event handlers. But try the fixes for ph1 and ph2 first.

Pete

in this state the traffic lights will behave like classic traffic light

Whatever this is supposed to actually mean.

You need to be more specfic about your sequences for changing lights.

I count about 11 different states for "classic traffic lights".