Different states with two buttons (Entrance control)

Hi,

So i’m making this project where i have two buttons, let’s say A and B in a corridor, they act like door alarms or something, where it counts if someone has gone through the whole corridor (so A and B are pressed and the other way around), and if someone got through A, and got back (so A is pressed twice), and finally if someone just got to A or B and immediattely got back (a short press).

So, to do this i was going to use if’s along with the millis function, but i could only make it short with short and longer presses, not with letting the button go and waiting for a press on B or just another press on the same button, so how do i do this? How do i make the button “wait” for another press (or not in case on the short one)?

This is just a sketch i’m making.

int buttonA = 8;  
int buttonB = 9;
int stateA;        
int stateB;
long secsH;      
long millisH;    
long prevsecsH; 
unsigned long firstTime;
byte previous = HIGH;
int in;
int out;
int inInc;
int exitInc;  


void setup() {
  Serial.begin(9600);         
  pinMode(buttonA, INPUT_PULLUP);  
  pinMode(buttonB, INPUT_PULLUP);
}

void loop() {
  stateA = digitalRead(buttonA); 
  stateB = digitalRead(buttonB);
  if (stateA == LOW && previous == HIGH && (millis() - firstTime) > 200) { 
    firstTime = millis();
 
    millisH = (millis() - firstTime);
  }
switch (stateA){
    case (millisH > 100):
          entinc++;
         
    
  }

  secsH = millisH / 1000; 
  
  if (millisH > 100) { 
    
    
    if (state == HIGH && previous == LOW) { 

      if (secsH <= 0 && secsH < 1) { 

  previous = state;
  prevsecsH = secsH;
}