IR Module sensor response time.

Hi guys, I make an arduino project regarding bidirectional people counter by using two IR module sensor by define one sensor as out and the other one as in.

My code seems works to me but in order for it to count, the people need to quickly pass through the two IR module sensor, and I mean really quickly or the it wont respond to it. LCD will print out the total people going in or out and LED as output if the count>=1.

Below is my code.
Is there anyway can I make the IR module sensor to respond even if people moving slowly through the two IR module sensor.

Any help will be highly appreciated. Thanks.

#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);

boolean sensor1 = false ;
boolean sensor2 = false ;
int count = 0 ;

void setup() {
lcd.begin(16,2);
lcd.print("People Counter");
delay(2000);
pinMode(14, INPUT);
pinMode(19, INPUT);
pinMode(2, OUTPUT);
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
}

void loop() {
sensor();
if (sensor1 == true) {
S1();
}
if (sensor2 == true){
S2();
}
}

void sensor() {
if (digitalRead(14) == HIGH) {
sensor1 = true;
}
else if (digitalRead(14) == LOW) {
sensor1 = false;
}
else if (digitalRead(19) == HIGH) {
sensor2 = true;
}
else if (digitalRead(19) == LOW) {
sensor2 = false;
}
else {
loop();}
}

void S1() {
while (sensor1 == true && sensor2 == false) {
sensor();
}
if (sensor1 == false && sensor2 == false) {
}
else if (sensor1 == true && sensor2 == true) {
S1S2();
}
else {
loop();
}
}

void S1S2() {
while (sensor1 == true && sensor2 == true) {
sensor();
}
if (sensor1 == false && sensor2 == true){
S2F();
}
else if (sensor1 == true && sensor2 == false){
S1();
}
else {
loop();
}
}

void S2F() {
while (sensor2 == true && sensor1 == false){
sensor();
}
if (sensor2 == false && sensor1 == false){
count++;
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);

if(count<=0)
{
lcd.clear();
digitalWrite(2,LOW);
lcd.clear();
lcd.print("Nobody In Room");
lcd.setCursor(0,1);
lcd.print("Light Is Off");
}
else 
  digitalWrite(2,HIGH);
loop();
}
else if (sensor1 == true && sensor2 == true){
S1S2();
}
else {
loop();
}
}

void S2() {
while (sensor2 == true && sensor1 == false) {
sensor();
}
if (sensor1 == false && sensor2 == false) {
}
else if (sensor1 == true && sensor2 == true) {
S2S1();
}
else {
loop();
}
}

void S2S1() {
while (sensor2 == true && sensor1 == true) {
sensor();
}
if (sensor2 == false && sensor1 == true){
S1F();
}
else if (sensor2 == true && sensor1 == false){
S2();
}
else {
loop();
}
}

void S1F() {
while (sensor1 == true && sensor2 == false){
sensor();
}
if (sensor1 == false && sensor2 == false){
count--;
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
if(count<=0)
{
lcd.clear();
digitalWrite(2,LOW);
lcd.clear();
lcd.print("Nobody In Room");
lcd.setCursor(0,1);
lcd.print("Light Is Off");
}
else 
  digitalWrite(2,HIGH);
loop();
}
else if (sensor2 == true && sensor1 == true){
S1S2();
}
else {
loop();
}
}

}
else {
loop();}
}

uncontrolled recursion is a recipe for a crash. You shouldn't be calling loop unless you know exactly what you are doing and it is obvious here that you don't. What are you actually trying to accomplish with this?

This whole thing needs to be rewritten. You've painted yourself into a corner. Read the sensors in one place in the code and react to them in another. You don't want to be calling sensor from all over the place.