Easy way to interrupt void loop

Soo what is the best and the easiest way to unterrupt the void loop and do something else. So let me explain. In the void loop function my LED light are blinking on 2s and that goes on and on...now i want to use a button where all the light will turn on when the button is in HIGH state, and when the button is released the lights continue to blink as they were at the start. Sorry for bad english,

void loop()
{

digitalWrite(24, HIGH);
delay (2000);
digitalWrite(24, LOW);

digitalWrite(26, HIGH);
delay (2000);
digitalWrite(26, LOW);
}

Your code doesn't compile.

Have a look at the blink without delay example in the IDE for clues.

You almost certainly don't need interrupts.

Code does compile and its working i know that there is somethig easier that interrupt but i dont remember what is it....

know that there is somethig easier that interrupt but i dont remember what is it....

See reply #1.

Post editing a post and then saying "does so!" doesn't cut it with me, I'm afraid.

The code in the OP still does not compile. Undefined reference to setup.

Adding

void setup(){}

will let it compile just fine.

Anyway, blink without delay that AWOL mentioned is the answer.

CrossRoads:
Adding

void setup(){}

will let it compile just fine.

But then there's the gulf to cross of actually getting it to do what you want.

The demo Several Things at a Time is an extended example of BWoD.

...R