Problems with Video Trigger system using Dual PIR sensors

Hi, I am hoping that someone will be able to help me with my project.

I am using a Leonardo board to process the inputs received from a pair of Panasonic PIR sensors mounted either side of an entrance door so that when a customer comes in it sends a trigger to a Moxa ioLogik E1212 that our media software can read to start the video.

The idea is that it only triggers when the customers come in through the door but not when the leave through the same door.

the issue i am encountering is that now it is installed i am getting triggers on exit as well as entry so need to refine the logic in the code to prevent this. I am not really a programmer, more of an engineer, but have managed to put together the code below that worked a treat when testing.

any help woudl be greatly appreciated.

Thanks in advance.

/*
 * PIR sensor tester
 */
 
int ledPin1 = 9;                 // choose the pin for the LED 1
int ledPin2 = 11;                // choose the pin for the LED 2
int ledPin3 = 13;                // choose the pin for the LED 3
int ledPin4 = 7;                 // choose the pin for the Trigger
int inputPin1 = 2;               // choose the input pin (for PIR sensor 1)
int inputPin2 = 3;               // choose the input pin (for PIR sensor 2)
int pirState1 = HIGH;            // we start, assuming no motion detected
int pirState2 = HIGH;            // we start, assuming no motion detected
int val1 = 0;                    // variable for reading the pin status
int val2 = 0;                    // variable for reading the pin status
 
void setup() {
  pinMode(ledPin1, OUTPUT);      // declare LED as output - Sensor 1 Triggered
  pinMode(ledPin2, OUTPUT);      // declare LED as output - Sensor 2 Triggered
  pinMode(ledPin3, OUTPUT);      // declare LED as output - Output Activated
  pinMode(ledPin4, OUTPUT);      // declare LED as output - Output to Moxa
  pinMode(inputPin1, INPUT);     // declare sensor as input - IR Sensor 1
  pinMode(inputPin2, INPUT);     // declare sensor as input - IR Sensor 2
 
  Serial.begin(9600);
}
 
void loop(){
  val1 = digitalRead(inputPin1);  // read input 1 value
  val2 = digitalRead(inputPin2);  // read input 2 value
  if (val1 == HIGH) {            // check if input 1 is HIGH
    digitalWrite(ledPin1, HIGH);  // turn LED 1 ON
    Serial.println("System Armed!"); // stage one armed
    delay(2000);                  // Wait to see if sensor 2 is triggered within 2 sec
    if (val2 == HIGH) {            // check if input 2 is HIGH
      digitalWrite(ledPin2, HIGH);  // turn LED 2 ON
          Serial.println("System Ready!"); // stage two armed
      if (pirState1 == LOW && pirState2 == LOW) {
      // we have just turned on
      delay(10);                  // Wait to to trigger video
      digitalWrite(ledPin3, HIGH);  // turn LED 3 ON
      digitalWrite(ledPin4, LOW);  // turn LED 3 ON
      // we have just triggerd the video
      Serial.println("Video Triggered!");
      // We only want to print on the output change, not state
      pirState1 = HIGH;
      pirState2 = HIGH;
    }
    }
  } else {
    digitalWrite(ledPin1, LOW); // turn LED 1 OFF
    digitalWrite(ledPin2, LOW); // turn LED 2 OFF
    digitalWrite(ledPin3, LOW); // turn LED 3 OFF
    digitalWrite(ledPin4, HIGH);  // turn Trigger OFF
    if (pirState1 == HIGH && pirState2 == HIGH) {
      // we have just turned off
      Serial.println("System Reset!");
      // We only want to print on the output change, not state
      pirState1 = LOW;
      pirState2 = LOW;
    }
  }

}

There's no way to do this with PIR sensors. Broad field of vision, just telling you whether there's motion somewhere in that fov.

Use a pair of break beam sensors instead, so you can tell the direction by which of the two beams gets broken first.