ISR interfering with loop() [solved]

Hi, I'm currently working on a project in which I am using an interrupt triggered by a switch, to turn on a relay connected to the mains input of a transformer, (i'm using led on pin 13 to test this) as well as a couple of power indicator LEDs and some other bits which are as of yet inconsequential! I've got the ISR working fine but now my loop() function doesn't seem to work even though all it does is turn on an LED. My ISR is a bit long and i've read that these should be kept short, but it is fairly critical that the interrupt function occurs at the time of the interrupt and that the switch is debounced so the relay turns on and off when expected. Also it is not apparent in my code yet, but (using a switch case controlled by a switch input) I want to generate pwm outputs to three stepper drivers based on the input of a Wii nunchuck. i don't want to include the power control in this section of code but still need to be able to switch it on and off. Here's my code if anyone could give me some insight into anything i'm doing wrong it would be much appreciated.

int  ledLow  = 7;
int  ledHigh  = 8;
int  powerOut = 13;


const unsigned int DEBOUNCE_TIME = 300;        
static unsigned long last_interrupt_time = 0; 

volatile  int  powerswitch2 = LOW;            

void setup() {
  
  pinMode(powerOut,OUTPUT);
  attachInterrupt(0,powerroutine,FALLING);
  
  pinMode(ledLow,OUTPUT);
  pinMode(ledHigh,OUTPUT);
  
}  


void loop() {
  
  digitalWrite(ledLow,HIGH);    
}

void  powerroutine()  {
  
  unsigned long interrupt_time = millis();

if (interrupt_time - last_interrupt_time > DEBOUNCE_TIME) {  
  
  powerswitch2 = !powerswitch2;   

  digitalWrite(ledHigh,powerswitch2);
  digitalWrite(powerOut,powerswitch2);
  
   last_interrupt_time = interrupt_time;
     }
   
 }

That sketch doesn't compile. Have you missed just a '}' or is there more?

sorry missed out a } when copying it over!

Can't see an obvious problem - how does the behaviour of the ledLow pin change when the attachInterrupt() call is commented out?

it turns on fine! ive been over it many many times trying to check for any mistakes!

Yeah that might be the problem! I have it wired with a pulldown resistor (10k) between the switch output and ground and am taking the switch input between the switch and the resistor. It doesn't work properly though! When I write the state of the button to the led pin the led turns on regardless of whether the switch has been pressed and turns of if i put digitalWrite(led,!button), so the switch input pin is reading high when it shouldn't. However i tried this code and the led never even turned on!

int button = 2;
int led = 8;


void setup() {
  pinMode(button,INPUT);
  pinMode(led,OUTPUT);
}

void loop() {

int readin;


readin = digitalRead(button);
digitalWrite(led,readin);


}

Surely this makes no sense!

not to mention the fact that with the interrupt routine it worked fine!

Are you saying that this code does not cause the LED connected to pin 7 to come on?

void loop() {
  
  digitalWrite(ledLow,HIGH);    
}

If so, exactly how is the LED connected?

Yeah i've got it working... It was a dodgy jumper wire... I've been tearing my hair out over this for ages. Sorry for wasting peoples time, thank you all anyway... :zipper_mouth_face: