Interrupt pin and SwitchStatement

Is there a way to use and interrupt pin to change your case switch within your main loop? IN my code you see that interrupt pin 2 calls void(interruptOne). In interruptOne I have an if statement IF (2 differtn buttons are high at same time, then switch case from S_statup to S_coldLow. Problem is that it doesn’t switch. How do I make this work? I want to use the interrupt pin so that I don’t have to call digitalRead constantly checking the pin

const int S_startup = 1;
const int S_coldLow = 2;


const byte interruptPin = 2;
int buttons = 1;
volatile byte state = LOW;
int changePin = 7;
int changePinState = 0;
int pinState = 0;
long debouncing_time = 15; //Debouncing Time in Milliseconds
volatile unsigned long last_micros;

const int ledPin = 11;
int ledState = LOW;
unsigned long previousMillis = 0;
const long interval = 1000;
void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), interruptOne, FALLING);
  pinMode(changePin, INPUT_PULLUP);
  Serial.begin(9600);
}

void loop() {

  int states = S_startup;
  //////////////////////////////////////////////////////////////////////
  // if(buttons==1){Serial.println("I got seven to go low and now 1");}
  //if(buttons==2){Serial.println("I got seven to go low and now 2");}
  //if(buttons==3){Serial.println("I got seven to go low and now 3");}
  //if(buttons==4){buttons=1;}
  ///////////////////////////////////////////////////////////////////

  //static int states = S_startup;

  switch (states) {


    case S_startup: {
        Serial.println("WE ARE IN startup STATE");

      } break;

    case S_coldLow: {
        Serial.println("WE ARE IN coldLow STATE");
      } break;




  }//END CASES
}//END LOOP
void interruptOne() {
  changePinState = digitalRead(changePin);
  static unsigned long last_interrupt_time = 0;
  unsigned long interrupt_time = millis();
  // If interrupts come faster than 200ms, assume it's a bounce and ignore

  if (interrupt_time - last_interrupt_time > 300)
  {
    if (changePinState == LOW) {
      buttons++;
      int states = S_coldLow;
    }
  }
  last_interrupt_time = interrupt_time;

}

void Interrupt() {
  buttons++;
  delay(10000);
}

Variables like changePinState must be declared volatile, if used by an interrupt routine to communicate with the main program.

Note: below, make button volatile too. delay() will not work in interrupt routines and is an extremely bad idea anyway.

void Interrupt() {
  buttons++;
  delay(10000);
}

UsernameD:
I want to use the interrupt pin so that I don't have to call digitalRead constantly checking the pin

Why?

The Arduino won't care. It will be doing 16 million instructions per second in either case.

Using digitalRead() constantly is referred to as "polling" and it is a very normal thing to do.

...R

+1 for the above. With polling, it is much easier to debounce button presses.

    if (changePinState == LOW) {
      buttons++;
      int states = S_coldLow;
    }

You're creating a new variable names states which immediately goes out of scope when the if statement ends. Having multiple variables with the same name in the same scope is usually a bad idea. But be sure that the states you created here in the interrupt has no effect on the variable names states that you are using in the switch statement.