How do I keep my sketch from repeating?

I have a very basic sketch I am wanting an LED to go through a startup sequence then remain lit after the sequence is finished I cannot for the life of me figure out how to achieve this. Obviously I am very new with this trying to put things together here. This is a headlight halo on my motorcycle I want the LED to light up red with the key on engine off, when the engine is started I want the led to go through a flicker sequence then light up white. I can handle getting it to do all this its just the staying lit up white part, the sketch below does not have any perameters yet for the inputs to tell the arduino when the key is on, or the engine is on (I am planning on crossing that bridge when I get there) so here is the sketch I have, also any thoughts you may have to clean this code up would be great!

int bluePin = 11;
int greenPin = 10;
int redPin = 12;
int bluerPin = 5;
int greenrPin = 6;
int redrPin = 3;

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop() {

  // startup sequence
  //red key on no engine start
  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, LOW);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, LOW);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(5000);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(150);

  //engine started
  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, LOW);
  delay(5);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(500);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, LOW);
  delay(10);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(150);

digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, LOW);
  delay(10);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(400);
  
  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, LOW);
  delay(75);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(150);

digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, LOW);
  delay(10);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(150);
 //start white

  digitalWrite(greenrPin, LOW);
  digitalWrite(redrPin, LOW);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, LOW);
  digitalWrite(greenPin, LOW);
  digitalWrite(bluePin, LOW);
  delay(10);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(150);
  
  digitalWrite(greenrPin, LOW);
  digitalWrite(redrPin, LOW);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, LOW);
  digitalWrite(greenPin, LOW);
  digitalWrite(bluePin, LOW);
  delay(150);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(500);
  
  digitalWrite(greenrPin, LOW);
  digitalWrite(redrPin, LOW);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, LOW);
  digitalWrite(greenPin, LOW);
  digitalWrite(bluePin, LOW);
  delay(250);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(150);
  
  digitalWrite(greenrPin, LOW);
  digitalWrite(redrPin, LOW);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, LOW);
  digitalWrite(greenPin, LOW);
  digitalWrite(bluePin, LOW);
  delay(10);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(150);
  
  digitalWrite(greenrPin, LOW);
  digitalWrite(redrPin, LOW);
  digitalWrite(bluerPin, LOW);
  digitalWrite(redPin, LOW);
  digitalWrite(greenPin, LOW);
  digitalWrite(bluePin, LOW);
  delay(10000);

  digitalWrite(greenrPin, HIGH);
  digitalWrite(redrPin, HIGH);
  digitalWrite(bluerPin, HIGH);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(150);
  
  
}[code]

[/code]

Create a flag and set it to clear condition (=0) - when void loop starts, check if the flag is set -(if (flag == 0) - at the end of the sequence, set flag=1. This will allow loop to skip that sequence and do other stuff later on.

void loop(){ if (start_flag == 0){ // do flashing light sequence start_flag = 1; } // end if (start flag)

// do other stuff

} // end void loop

in order to use that I have to identify the "start_flag" in the void setup right?

It would typically be in the declarations that go before void setup(), with all the other variables and pin assignments, etc.

You can also just paste your loop() code into the setup() function. It only runs setup() once so you're good to go.

Got it, thank you SO SO SO SO SO much for your help!

People also often use:

while(1);

This is simple to add in anywhere and the code will then stop at that position.

I think that this works too:

for(;;);

Edit - stupid thing turned it into a smiley...

Edit - stupid thing turned it into a smiley...

I'm sure that is a C++ feature. :D

Lefty