LED Neon Flicker

UPDATE: Found a workable solution for what I need. Posted it down below for anyone who might need a similar effect.

I am trying to simulate a neon sign flickering on before going solid. I found this guys video and he posted his code in the comments. The problem is I can't make heads or tails of it since I didn't write it.

I just want to have the sketch run when I power on the arduino. No need for a button or anything. Any help would be appreciated.

#define DATA_PIN 3
#define BUTTON_PIN 4

boolean lightOn = 0; 

void setup() {   
 pinMode(DATA_PIN, OUTPUT);
 pinMode(BUTTON_PIN, INPUT);
 } 
 
const int blinkOn[] = {10, 20, 20, 240, 20, 40, 20, 100, 20, 20, 20, 260, 80, 20, 240, 60, 160, 20, 240, 20, 1000, 20, 20, 40, 100, 20, 2740, 340, 860, 20, 1400, 20, 60, 20}; 

void allOn(boolean on) {   
  digitalWrite(DATA_PIN, on);
 }  
 
 void updateLeds() {
  allOn(lightOn);
 }
 
 boolean myDelay(unsigned int ms) {   
  unsigned long startTime = millis();  
  unsigned long endTime = startTime+ms; 
       
 while(millis() < endTime) {
     if(!digitalRead(BUTTON_PIN)) {
       return 1;
     }    
 // Update colour and intencity of leds     updateLeds();
     delay(1);
   }
   return 0;
 } 
 
void turnOn() {
   // Don't flicker, if the light is already on
   if(lightOn)
     return;
     
 // Start to flicker   
        for(int i=0; i<sizeof(blinkOn)/sizeof(int); ++i) {    
lightOn = !(i&1);
if(myDelay(blinkOn[i])) { 
    // Button is no longer pushed 
    allOn(false);   
    lightOn = false;  
    return; 
    }  
 }
 
   // Make sure the light is actually on 
  allOn(true); 
  lightOn = true;
 } 
 
void turnOff() { 
  lightOn = false; 
  allOn(false);
 } 
 
void loop() {
    delay(100);
   if(digitalRead(BUTTON_PIN))
     turnOn();
   else
      turnOff();
}

Bizzaro:
The problem is I can't make heads or tails of

Well, it is a bit of a mess! Is that exactly how it was when you downloaded it? It would help if you could click Tools->AutoFormat in the IDE and either re-post or modify your post above.

Yes that is how it is. (from his YT comments. Even he admits it's a bit janky) Running thru Auto format didn't change too much.

#define DATA_PIN 3
#define BUTTON_PIN 4

boolean lightOn = 0;

void setup() {
  pinMode(DATA_PIN, OUTPUT);
  pinMode(BUTTON_PIN, INPUT);
}

const int blinkOn[] = {10, 20, 20, 240, 20, 40, 20, 100, 20, 20, 20, 260, 80, 20, 240, 60, 160, 20, 240, 20, 1000, 20, 20, 40, 100, 20, 2740, 340, 860, 20, 1400, 20, 60, 20};

void allOn(boolean on) {
  digitalWrite(DATA_PIN, on);
}

void updateLeds() {
  allOn(lightOn);
}

boolean myDelay(unsigned int ms) {
  unsigned long startTime = millis();
  unsigned long endTime = startTime + ms;

  while (millis() < endTime) {
    if (!digitalRead(BUTTON_PIN)) {
      return 1;
    }
    // Update colour and intencity of leds
    updateLeds();
    delay(1);
  }
  return 0;
}

void turnOn() {
  // Don't flicker, if the light is already on
  if (lightOn)
    return;

  // Start to flicker
  for (int i = 0; i < sizeof(blinkOn) / sizeof(int); ++i) {
    lightOn = !(i & 1);
    if (myDelay(blinkOn[i])) {
      // Button is no longer pushed
      allOn(false);
      lightOn = false;
      return;
    }
  }

  // Make sure the light is actually on
  allOn(true);
  lightOn = true;
}

void turnOff() {
  lightOn = false;
  allOn(false);
}

void loop() {
  delay(100);
  if (digitalRead(BUTTON_PIN))
    turnOn();
  else
    turnOff();
}

That's better.

Try replacing

  if (digitalRead(BUTTON_PIN))

With

  if (true)

That didn't seem to change anything but after working on this all day I found another post for a candle flicker sketch I could alter to get the desired results.

For anyone who might need something like this in the future, here is my code:

int ledNeon = 9;           // choose the pin for the LED
int val = 0;                 // variable for reading the pin status
int max_count = 80;          // counter for the flicker table
int countTwo = 0;
byte Flicker_table[] = { 10, 10, 20, 30, 30, 30, 40, 50, 60, 70, 80, 70, 70, 
                           60, 60, 50, 50, 50, 60, 70, 80, 90, 100,
                           120,140,160,240,250,100,150,250,250,140,
                           240,230,220,100, 80,70,70, 70, 80, 80,
                           140,130,120,110,200,210,220,220,100, 90,
                            40, 30, 30, 30, 20, 10, 10 };
                           

void setup() {
 pinMode(ledNeon, OUTPUT);   // declare Wind led as output

  if (val == HIGH) {            // check if the input is HIGH
 } else {
      delay(30);
   for ( int i=0; i <= 150; i++) {  // This for loop runs untill the flicker table finishes
   analogWrite(ledNeon, Flicker_table[countTwo]);
     countTwo++;
     if(countTwo > max_count ){
     countTwo = 0;  // Helps makes sure our next flicker doesnt start in an arbitrary place on the table
   }
   delay(20);  // the delay for our flicker, make it faster to to make it flicker a little more violently
   digitalWrite(ledNeon, HIGH);
   }
 }
}

void loop(){
}

I am using it to simulate the flicker of a neon sign for EL wire using a relay.

So no leds were ever involved. How bizzaro.