Interrupts not fully running functions

I am trying to create some push button that will control the lighting for some game shows we are making for festivals.
I want 3 things to happen:
First is just a standard waiting loop - which I (think I) have got
Second is a 'game on' lighting loop
Third is a 'BIG WINNER' everything light ups, goes crazy.

We are still finalising the gameshow, hence the actual functions/timings are not final. However, i want to have it so i can just bang the actual code out for how the lighting will function when we have everything setup.

Sounds will be attached via a separate sound board using the push buttons (this bit seems easy).

I am using tactile buttons.

I have been searching, trying other projects, messing and mashing code for the last few of months and have a basic under standing of what i am doing, but generally i am a complete noob.

My current problem is that when i press a button it does something, but does not seem to run the function linked to it.
Ideally, i want to push the game on button and have it stop when i hit the WINNER button or hit the button again.

I know i could make things more stream lined, but i am new and want to get the basic use down then make it cleaner.

Every-time i play i get a little further, but feel I am ready for some guidance.
I don't expect any to re-write this for me, i want to know why and what it is doing.
Absolutely any help or direction on this would be amazing.
Thank-you :slight_smile:

volatile int output = LOW;                      
const int ledPin = 8;   
const int ledPin1 = 9;
const int ledPin2 = 10;
const int ledPin3 = 11;
const int ledPin4 = 12;
const int ledPin5 = 13;

 const  int dTime = 1000; 
 const int dTime1 = 200;  

void setup()                                                      

{
  pinMode(ledPin, OUTPUT);
    pinMode(ledPin1, OUTPUT);
      pinMode(ledPin2, OUTPUT);
        pinMode(ledPin3, OUTPUT);
          pinMode(ledPin4, OUTPUT);
            pinMode(ledPin5, OUTPUT);
        pinMode(pushB3, INPUT);

        Serial.begin(9600);
            
  attachInterrupt(digitalPinToInterrupt(2),buttonPressed1,RISING);  //  function for creating external interrupts at pin2 on Rising (LOW to HIGH)
  attachInterrupt(digitalPinToInterrupt(3),buttonPressed2,RISING);  //  function for creating external interrupts at pin3 on Rising (LOW to HIGH)   
  
}

void blinkLED()
{
  digitalWrite(ledPin, HIGH);  
    digitalWrite(ledPin2, HIGH);
      digitalWrite(ledPin5, HIGH);
      digitalWrite(ledPin4, HIGH);
       digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin3, LOW);
  delay(dTime);
  digitalWrite(ledPin, LOW);
  digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin1, HIGH);
      digitalWrite(ledPin3, HIGH);
    digitalWrite(ledPin4, LOW);
  delay(dTime);
    digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin, HIGH);
      digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin4, HIGH);
  delay(dTime);
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin, HIGH);
      digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin4, LOW);
  delay(dTime);
      digitalWrite(ledPin, LOW);
  digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin1, HIGH);
      digitalWrite(ledPin3, HIGH);
    digitalWrite(ledPin, LOW);
      delay(dTime);
       digitalWrite(ledPin5, LOW);
}
void waiting1()
{
  digitalWrite(ledPin, HIGH);
  delay(dTime);
  digitalWrite(ledPin1, HIGH);
  delay(dTime);
   digitalWrite(ledPin2, HIGH);
  delay(dTime);
   digitalWrite(ledPin3, HIGH);
  delay(dTime);
  digitalWrite(ledPin, LOW);
    digitalWrite(ledPin1, LOW);
   digitalWrite(ledPin2, LOW);
      digitalWrite(ledPin3, LOW);
      delay(dTime);
}
void waiting2()  // 1-2-3-4 cycle
{
    digitalWrite(ledPin, HIGH);
  delay(dTime1);
  digitalWrite(ledPin1, HIGH);
  digitalWrite(ledPin, LOW);
  delay(dTime1);
   digitalWrite(ledPin2, HIGH);
   digitalWrite(ledPin1, LOW);
  delay(dTime1);
   digitalWrite(ledPin3, HIGH);
   digitalWrite(ledPin2, LOW);
  delay(dTime1);
  digitalWrite(ledPin3, LOW);
}

void twoWay()
{
 digitalWrite(ledPin4, HIGH);
   digitalWrite(ledPin2, HIGH);
  delay(dTime);
  digitalWrite(ledPin2, LOW);
   digitalWrite(ledPin4, LOW);
     digitalWrite(ledPin3, HIGH);
       digitalWrite(ledPin5, HIGH);
  delay(dTime);
   digitalWrite(ledPin3, LOW);
     digitalWrite(ledPin5, LOW);
}
void loop()                                                      
{
  Serial.println("checking on");  //I am using the monitor to see what the arduino is 
  waiting2();                      //registering and where it is.
}
 
                      //GAME ON
void buttonPressed1()         //ISR function excutes when push button at pinD2 is pressed
{           
  Serial.println("button 1 pressed");         
   twoWay();
   twoWay();              //I tried to tell it to do the function a few times
   twoWay();                //but the lights just blink for a second and didn't seem to run.
   twoWay();
}
                    //BIG WINNER
void buttonPressed2()           //ISR function excutes when push button at pinD3 is pressed                             
{        
  Serial.println("button 2 pressed");            
    blinkLED();  
     blinkLED();                
      blinkLED();  
       blinkLED();                       
}

First off, ditch the interrupts to detect a button press. It is much better to sample the button states each time through loop() and then act upon their state.

Your current problem is that you are calling delay() within your ISR. You can't do this. timing relies on interrupts being ON and they are OFF during an ISR.

A much better approach would be to read the post "How to do multiple things at once" and look at the example "BlinkWithoutDelay" to see how to do things without using delay(). This will alllow your loop() function to cycle as quickly as possible, enabling you to detect button presses as well as do all the other things you want.

ok, will do, thank you!

The demo Several Things at a Time is an extended example of BWoD and illustrates the use of millis() to manage timing without blocking. It may help with understanding the technique.

Have a look at Using millis() for timing. A beginners guide if you need more explanation.

You may also get some ideas from Planning and Implementing a Program

...R