A problem of displaying information in a flash.

I recently took up a project to create a Second I-Ching reading generator in order to keep what I have learned from C programing from getting rusty. I have had success with it however due to an obsession of wanting to improve it I ran into some problems.

The current problem is a re-write of one of the program functions.

CURRENT CODE:
This current code displays information in a flash on a 7Segment 4-digit display and then disappears. While I think I may have an idea as to what which would be for the fact that within one of the ‘if’ statements the condition that makes it true gets set immediately to zero.
As of writing this I am think I may have to code a delay with use of the millis() function.

void taps_func(){
  
  //////
  taps_buttonstate=digitalRead(inputPins[3]);
  
  
  if(taps_buttonstate != taps_lastbuttonstate){
   
   
    if(taps_buttonstate==HIGH){
     
      digitalWrite(thinkingled,HIGH);
      
      
    if((millis()-taps_t)>=taps_debounce){
         taps_show=false;
         display.clear();
        taps_buttonpushcounter++;
        taps_n=taps_buttonpushcounter%3;
        taps[taps_n]=random(2,4);
    
        



////

        
       



}
       
        
        
        
        taps_t=millis();
      
      
      }
     
        
    
    }
  
  
  
    
  taps_lastbuttonstate=taps_buttonstate;
  ////////
 if(toss==6){
          taps_show=true;
          toss=0;
       
         
          }
  
////
if(toss<6){
  if(taps_show==false){
  if( taps_buttonpushcounter==0){display.print(taps[0]);}
  if( taps_buttonpushcounter==1){display.print(taps[1]);}
   if( taps_buttonpushcounter==2){display.print(taps[2]);}
  if(taps_buttonpushcounter==3){
    tone(buzzer,notes[5],125);
     taps_sum=taps[0]+taps[1]+taps[2];
 
  display.printDualCounter(6-toss,taps_sum);
  Lline[toss]=taps_sum;
  if(Lline[toss]!=6||Lline[toss]!=9){Rline[toss]=Lline[toss];}
  if(Lline[toss]==6){Rline[toss]=7;Lline[toss]=8;}
  if(Lline[toss]==9){Rline[toss]=8;Lline[toss]=7;}
 noTone(buzzer);
  toss++;
  taps_n=0;
  taps_buttonpushcounter=0;}
  
}
}
if(taps_show==true){
  
   digitalWrite(thinkingled,LOW);
         
          
        
          lines();
           display.clear();
          display.printDualCounter(L_read,R_read);
}

}

THE PREVIOUS CODE:

This code worked fine, however you may notice I am reading from a different button which is due to a whole rework of the menu system.

void taps_func(){
  
  //////
  taps_buttonstate=digitalRead(button[2]);
  
  
  if(taps_buttonstate != taps_lastbuttonstate){
   
   
    if(buttonstate==HIGH){
     
      digitalWrite(thinkingled,HIGH);
      
      
    if((millis()-taps_debounce)>=debouncedelay){
        
        taps_n=taps_buttonpushcounter;
        taps_buttonpushcounter++;
        taps_buttonpushcounter=taps_buttonpushcounter%3;
        taps[taps_n]=random(2,4);
        if(toss==6){
          
          runcmd=1;
          digitalWrite(thinkingled,LOW);
          display.clear();
          toss=0;
          lines();
          display.printDualCounter(L_read,R_read);
          
          WriteSD();
          runcmd=0;}



}
       
        
        
        
        taps_debounce=millis();
      
      
      }
     
        
    
    }
  
  
  
    
  taps_lastbuttonstate=taps_buttonstate;

////////

  
////
if(toss<6){
 
 
  if(taps_n==2){
  
  taps_sum=taps[0]+taps[1]+taps[2];
  Lline[toss]=taps_sum;
  if(Lline[toss]!=6||Lline[toss]!=9){Rline[toss]=Lline[toss];}
  if(Lline[toss]==6){Rline[toss]=7;Lline[toss]=8;}
  if(Lline[toss]==9){Rline[toss]=8;Lline[toss]=7;}
   display.printDualCounter(6-toss,taps_sum);
  toss++;
  taps_n=0;
  }
  
}
////

}

Unrelated notes:
I don’t know if this necessary but have included this section of the post in case anyone may want more more information.

Yes as you may have seen in the previous code I indeed have an SD card feature to this device. Why would I have that would be to track how random the device actually is. There is also an RTC module and an array of sensors for the randomSeed function to choose it’s seed value from.

Why the current code is being reworked has to do with a re-write to the mode selection menu.

I was inspired by the following video and felt that the authors method was more streamlined than the bulky and possibly confusing menu system I had created.
Ep. 59 - Arduino LCD Display Menu System Tutorial, Scrolling Menu, Changeable Variables for Projects

Here is a demo video of the actual device with it’s forerunner:
I-Ching divination computer old and new

And also if your interested in exploring the code I am using here is my github (which is still a work in progess),
https://github.com/The-High-Castle/I-Ching-Code

It looks like you are only resetting your taps_t variable when a button is HIGH. You need to reset it every time the current state is not like the previous state.

Look at this tutorial and adapt to your code https://www.arduino.cc/en/Tutorial/Debounce