Compact large code

Im trying to code a strip of LED lights into constellations for an exhibit and im having trouble with the size of the code. I don’t know how to make it smaller in order for it not to freeze when pressing a button.

Heres my code:

Constellations.ino (12.5 KB)

          strip.setPixelColor(0, 255, 255, 255);
          strip.show(); // Initialize all pixels to 'off'
          delay(200);
          strip.setPixelColor(1, 255, 255, 255);
          strip.show(); // Initialize all pixels to 'off'
          delay(200);
          strip.setPixelColor(2, 255, 255, 255);
          strip.show(); // Initialize all pixels to 'off'
          delay(200);
          strip.setPixelColor(3, 255, 255, 255);
          strip.show(); // Initialize all pixels to 'off'
          delay(200);
          strip.setPixelColor(4, 255, 255, 255);
          strip.show(); // Initialize all pixels to 'off'
          delay(200);
          strip.setPixelColor(5, 255, 255, 255);
          strip.show(); // Initialize all pixels to 'off'
          delay(200);
          strip.setPixelColor(6, 255, 255, 255);
          strip.show(); // Initialize all pixels to 'off'
          delay(200);
          strip.setPixelColor(7, 255, 255, 255);
          strip.show(); // Initialize all pixels to 'off'

Note that the first parameter of setPixelColor() in this section of the program has a pattern that would allow you to use a for loop, as would several other program sections

dalta: make it smaller in order for it not to freeze when pressing a button

It's not the size of the code that's making it freeze when you press a button, I suspect. I've not reviewed your code because I can't open a .ino attachment on my phone, but from the portion that Bob posted,I guess that your problem is caused by using delay().