Led matrix white flashing problem

I have a Led matrix with 3 switches for 3 different displays. I control the speed and brightness with 2 or 3 potentiometers.

The whole thing works quite well so far. But today I wanted to introduce a fourth switch that only makes the LED panel glow white.

The problem is when I test this one by one. So switch on white led everything works fine. However, if I add that to my actual sketch, the white flashes very quickly. Everything else works the same as before. Only white flashes :frowning:

Can someone please help me and explain why?

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 3

const int SW_1 = 10;
const int SW_2 = 11;
const int SW_3 = 12;
const int SW_4 = 8;

int pot1       = A0;
int del1       = 0;
int pot2       = A1;
int del2       = 0;
int pot3     = A2;
int bright     = 0;


Adafruit_NeoPixel strip = Adafruit_NeoPixel(256, PIN, NEO_GRB + NEO_KHZ800);

void setup()
{

  pinMode(SW_1, INPUT);
  pinMode(SW_2, INPUT);
  pinMode(SW_3, INPUT);
  strip.begin();
  strip.show();
}

void loop()
{
  bright = analogRead(pot3); // wir legen fest, dass die Variable pot1_wert für uns den Wert des Potis speichert
  bright = map(bright, 0, 1023, 0, 64);
  del1   = analogRead(pot1);
  del2   = analogRead(pot2);

 

  if (digitalRead(SW_1) == HIGH)
  {
    strip.fill(strip.Color(0, 0, 255), 0, 8);
    strip.fill(strip.Color(0, 0, 255), 24, 8);
    strip.fill(strip.Color(0, 0, 255), 32, 8);
    strip.fill(strip.Color(0, 0, 255), 56, 8);
    strip.fill(strip.Color(0, 0, 255), 64, 8);
    strip.fill(strip.Color(0, 0, 255), 88, 8);
    strip.fill(strip.Color(0, 0, 255), 96, 8);
    strip.fill(strip.Color(0, 0, 255), 120, 8);
    strip.fill(strip.Color(0, 0, 255), 136, 8);
    strip.fill(strip.Color(0, 0, 255), 144, 8);
    strip.fill(strip.Color(0, 0, 255), 168, 8);
    strip.fill(strip.Color(0, 0, 255), 176, 8);
    strip.fill(strip.Color(0, 0, 255), 200, 8);
    strip.fill(strip.Color(0, 0, 255), 208, 8);
    strip.fill(strip.Color(0, 0, 255), 232, 8);
    strip.fill(strip.Color(0, 0, 255), 240, 8);
    strip.setBrightness(bright);
    strip.show();
    delay(del1);
    strip.clear();
    strip.show();
    delay(del1);
    strip.fill(strip.Color(0, 0, 255), 8, 8);
    strip.fill(strip.Color(0, 0, 255), 16, 8);
    strip.fill(strip.Color(0, 0, 255), 40, 8);
    strip.fill(strip.Color(0, 0, 255), 48, 8);
    strip.fill(strip.Color(0, 0, 255), 72, 8);
    strip.fill(strip.Color(0, 0, 255), 80, 8);
    strip.fill(strip.Color(0, 0, 255), 104, 8);
    strip.fill(strip.Color(0, 0, 255), 112, 8);
    strip.fill(strip.Color(0, 0, 255), 128, 8);
    strip.fill(strip.Color(0, 0, 255), 152, 8);
    strip.fill(strip.Color(0, 0, 255), 160, 8);
    strip.fill(strip.Color(0, 0, 255), 184, 8);
    strip.fill(strip.Color(0, 0, 255), 192, 8);
    strip.fill(strip.Color(0, 0, 255), 216, 8);
    strip.fill(strip.Color(0, 0, 255), 224, 8);
    strip.fill(strip.Color(0, 0, 255), 248, 8);
    strip.setBrightness(bright);
    strip.show();
    delay(del1);
    strip.clear();
    strip.show();
    delay(del1);
    strip.fill(strip.Color(0, 0, 255), 0, 8);
    strip.fill(strip.Color(0, 0, 255), 24, 8);
    strip.fill(strip.Color(0, 0, 255), 32, 8);
    strip.fill(strip.Color(0, 0, 255), 56, 8);
    strip.fill(strip.Color(0, 0, 255), 64, 8);
    strip.fill(strip.Color(0, 0, 255), 88, 8);
    strip.fill(strip.Color(0, 0, 255), 96, 8);
    strip.fill(strip.Color(0, 0, 255), 120, 8);
    strip.fill(strip.Color(0, 0, 255), 136, 8);
    strip.fill(strip.Color(0, 0, 255), 144, 8);
    strip.fill(strip.Color(0, 0, 255), 168, 8);
    strip.fill(strip.Color(0, 0, 255), 176, 8);
    strip.fill(strip.Color(0, 0, 255), 200, 8);
    strip.fill(strip.Color(0, 0, 255), 208, 8);
    strip.fill(strip.Color(0, 0, 255), 232, 8);
    strip.fill(strip.Color(0, 0, 255), 240, 8);
    strip.setBrightness(bright);
    strip.show();
    delay(del1);
    strip.clear();
    strip.show();
    delay(del1);
    strip.fill(strip.Color(0, 0, 255), 8, 8);
    strip.fill(strip.Color(0, 0, 255), 16, 8);
    strip.fill(strip.Color(0, 0, 255), 40, 8);
    strip.fill(strip.Color(0, 0, 255), 48, 8);
    strip.fill(strip.Color(0, 0, 255), 72, 8);
    strip.fill(strip.Color(0, 0, 255), 80, 8);
    strip.fill(strip.Color(0, 0, 255), 104, 8);
    strip.fill(strip.Color(0, 0, 255), 112, 8);
    strip.fill(strip.Color(0, 0, 255), 128, 8);
    strip.fill(strip.Color(0, 0, 255), 152, 8);
    strip.fill(strip.Color(0, 0, 255), 160, 8);
    strip.fill(strip.Color(0, 0, 255), 184, 8);
    strip.fill(strip.Color(0, 0, 255), 192, 8);
    strip.fill(strip.Color(0, 0, 255), 216, 8);
    strip.fill(strip.Color(0, 0, 255), 224, 8);
    strip.fill(strip.Color(0, 0, 255), 248, 8);
    strip.setBrightness(bright);
    strip.show();
    delay(del1);
    strip.clear();
    strip.show();
    delay(del2);
    strip.fill(strip.Color(0, 0, 255), 0, 256);
    strip.setBrightness(bright);
    strip.show();
    delay(del2);
    strip.clear();
    strip.show();
    delay(del2);
    strip.fill(strip.Color(0, 0, 255), 0, 256);
    strip.setBrightness(bright);
    strip.show();
    delay(del2);
    strip.clear();
    strip.show();
    delay(del2);
    strip.fill(strip.Color(0, 0, 255), 0, 256);
    strip.setBrightness(bright);
    strip.show();
    delay(del2);
    strip.clear();
    strip.show();
    delay(del2);
  }
  else
  {
    strip.clear();
    strip.show();
  }



  if (digitalRead(SW_2) == HIGH)
  {
    strip.setPixelColor(49, (strip.Color(255, 90, 0)));
    strip.setPixelColor(50, (strip.Color(255, 90, 0)));
    strip.setPixelColor(51, (strip.Color(255, 90, 0)));
    strip.setPixelColor(52, (strip.Color(255, 90, 0)));
    strip.setPixelColor(53, (strip.Color(255, 90, 0)));
    strip.setPixelColor(54, (strip.Color(255, 90, 0)));
    strip.setPixelColor(78, (strip.Color(255, 90, 0)));
    strip.setPixelColor(81, (strip.Color(255, 90, 0)));
    strip.setPixelColor(110, (strip.Color(255, 90, 0)));
    strip.setPixelColor(113, (strip.Color(255, 90, 0)));
    strip.setPixelColor(114, (strip.Color(255, 90, 0)));
    strip.setPixelColor(115, (strip.Color(255, 90, 0)));
    strip.setPixelColor(116, (strip.Color(255, 90, 0)));
    strip.setPixelColor(117, (strip.Color(255, 90, 0)));
    strip.setPixelColor(118, (strip.Color(255, 90, 0)));
    strip.setPixelColor(137, (strip.Color(255, 90, 0)));
    strip.setPixelColor(150, (strip.Color(255, 90, 0)));
    strip.setPixelColor(169, (strip.Color(255, 90, 0)));
    strip.setPixelColor(182, (strip.Color(255, 90, 0)));
    strip.setPixelColor(201, (strip.Color(255, 90, 0)));
    strip.setPixelColor(202, (strip.Color(255, 90, 0)));
    strip.setPixelColor(203, (strip.Color(255, 90, 0)));
    strip.setPixelColor(204, (strip.Color(255, 90, 0)));
    strip.setPixelColor(205, (strip.Color(255, 90, 0)));
    strip.setPixelColor(206, (strip.Color(255, 90, 0)));
    strip.setPixelColor(62, (strip.Color(255, 90, 0)));
    strip.setPixelColor(61, (strip.Color(255, 90, 0)));
    strip.setPixelColor(60, (strip.Color(255, 90, 0)));
    strip.setPixelColor(59, (strip.Color(255, 90, 0)));
    strip.setPixelColor(58, (strip.Color(255, 90, 0)));
    strip.setPixelColor(57, (strip.Color(255, 90, 0)));
    strip.setPixelColor(70, (strip.Color(255, 90, 0)));
    strip.setPixelColor(89, (strip.Color(255, 90, 0)));
    strip.setPixelColor(102, (strip.Color(255, 90, 0)));
    strip.setPixelColor(121, (strip.Color(255, 90, 0)));
    strip.setPixelColor(134, (strip.Color(255, 90, 0)));
    strip.setPixelColor(153, (strip.Color(255, 90, 0)));
    strip.setPixelColor(166, (strip.Color(255, 90, 0)));
    strip.setPixelColor(185, (strip.Color(255, 90, 0)));
    strip.setPixelColor(198, (strip.Color(255, 90, 0)));
    strip.setPixelColor(197, (strip.Color(255, 90, 0)));
    strip.setPixelColor(196, (strip.Color(255, 90, 0)));
    strip.setPixelColor(195, (strip.Color(255, 90, 0)));
    strip.setPixelColor(194, (strip.Color(255, 90, 0)));
    strip.setPixelColor(193, (strip.Color(255, 90, 0)));
    strip.setBrightness(bright);
    strip.show();
    delay(del1);
    strip.clear();
    strip.show();
    delay(del1);
    strip.setPixelColor(49, (strip.Color(255, 90, 0)));
    strip.setPixelColor(50, (strip.Color(255, 90, 0)));
    strip.setPixelColor(51, (strip.Color(255, 90, 0)));
    strip.setPixelColor(52, (strip.Color(255, 90, 0)));
    strip.setPixelColor(53, (strip.Color(255, 90, 0)));
    strip.setPixelColor(54, (strip.Color(255, 90, 0)));
    strip.setPixelColor(78, (strip.Color(255, 90, 0)));
    strip.setPixelColor(81, (strip.Color(255, 90, 0)));
    strip.setPixelColor(110, (strip.Color(255, 90, 0)));
    strip.setPixelColor(113, (strip.Color(255, 90, 0)));
    strip.setPixelColor(114, (strip.Color(255, 90, 0)));
    strip.setPixelColor(115, (strip.Color(255, 90, 0)));
    strip.setPixelColor(116, (strip.Color(255, 90, 0)));
    strip.setPixelColor(117, (strip.Color(255, 90, 0)));
    strip.setPixelColor(118, (strip.Color(255, 90, 0)));
    strip.setPixelColor(137, (strip.Color(255, 90, 0)));
    strip.setPixelColor(150, (strip.Color(255, 90, 0)));
    strip.setPixelColor(169, (strip.Color(255, 90, 0)));
    strip.setPixelColor(182, (strip.Color(255, 90, 0)));
    strip.setPixelColor(201, (strip.Color(255, 90, 0)));
    strip.setPixelColor(202, (strip.Color(255, 90, 0)));
    strip.setPixelColor(203, (strip.Color(255, 90, 0)));
    strip.setPixelColor(204, (strip.Color(255, 90, 0)));
    strip.setPixelColor(205, (strip.Color(255, 90, 0)));
    strip.setPixelColor(206, (strip.Color(255, 90, 0)));
    strip.setPixelColor(62, (strip.Color(255, 90, 0)));
    strip.setPixelColor(61, (strip.Color(255, 90, 0)));
    strip.setPixelColor(60, (strip.Color(255, 90, 0)));
    strip.setPixelColor(59, (strip.Color(255, 90, 0)));
    strip.setPixelColor(58, (strip.Color(255, 90, 0)));
    strip.setPixelColor(57, (strip.Color(255, 90, 0)));
    strip.setPixelColor(70, (strip.Color(255, 90, 0)));
    strip.setPixelColor(89, (strip.Color(255, 90, 0)));
    strip.setPixelColor(102, (strip.Color(255, 90, 0)));
    strip.setPixelColor(121, (strip.Color(255, 90, 0)));
    strip.setPixelColor(134, (strip.Color(255, 90, 0)));
    strip.setPixelColor(153, (strip.Color(255, 90, 0)));
    strip.setPixelColor(166, (strip.Color(255, 90, 0)));
    strip.setPixelColor(185, (strip.Color(255, 90, 0)));
    strip.setPixelColor(198, (strip.Color(255, 90, 0)));
    strip.setPixelColor(197, (strip.Color(255, 90, 0)));
    strip.setPixelColor(196, (strip.Color(255, 90, 0)));
    strip.setPixelColor(195, (strip.Color(255, 90, 0)));
    strip.setPixelColor(194, (strip.Color(255, 90, 0)));
    strip.setPixelColor(193, (strip.Color(255, 90, 0)));
    strip.setBrightness(bright);
    strip.show();
    delay(del1);
    strip.clear();
    strip.show();
    delay(del1);
    strip.setPixelColor(49, (strip.Color(255, 90, 0)));
    strip.setPixelColor(50, (strip.Color(255, 90, 0)));
    strip.setPixelColor(51, (strip.Color(255, 90, 0)));
    strip.setPixelColor(52, (strip.Color(255, 90, 0)));
    strip.setPixelColor(53, (strip.Color(255, 90, 0)));
    strip.setPixelColor(54, (strip.Color(255, 90, 0)));
    strip.setPixelColor(78, (strip.Color(255, 90, 0)));
    strip.setPixelColor(81, (strip.Color(255, 90, 0)));
    strip.setPixelColor(110, (strip.Color(255, 90, 0)));
    strip.setPixelColor(113, (strip.Color(255, 90, 0)));
    strip.setPixelColor(114, (strip.Color(255, 90, 0)));
    strip.setPixelColor(115, (strip.Color(255, 90, 0)));
    strip.setPixelColor(116, (strip.Color(255, 90, 0)));
    strip.setPixelColor(117, (strip.Color(255, 90, 0)));
    strip.setPixelColor(118, (strip.Color(255, 90, 0)));
    strip.setPixelColor(137, (strip.Color(255, 90, 0)));
    strip.setPixelColor(150, (strip.Color(255, 90, 0)));
    strip.setPixelColor(169, (strip.Color(255, 90, 0)));
    strip.setPixelColor(182, (strip.Color(255, 90, 0)));
    strip.setPixelColor(201, (strip.Color(255, 90, 0)));
    strip.setPixelColor(202, (strip.Color(255, 90, 0)));
    strip.setPixelColor(203, (strip.Color(255, 90, 0)));
    strip.setPixelColor(204, (strip.Color(255, 90, 0)));
    strip.setPixelColor(205, (strip.Color(255, 90, 0)));
    strip.setPixelColor(206, (strip.Color(255, 90, 0)));
    strip.setPixelColor(62, (strip.Color(255, 90, 0)));
    strip.setPixelColor(61, (strip.Color(255, 90, 0)));
    strip.setPixelColor(60, (strip.Color(255, 90, 0)));
    strip.setPixelColor(59, (strip.Color(255, 90, 0)));
    strip.setPixelColor(58, (strip.Color(255, 90, 0)));
    strip.setPixelColor(57, (strip.Color(255, 90, 0)));
    strip.setPixelColor(70, (strip.Color(255, 90, 0)));
    strip.setPixelColor(89, (strip.Color(255, 90, 0)));
    strip.setPixelColor(102, (strip.Color(255, 90, 0)));
    strip.setPixelColor(121, (strip.Color(255, 90, 0)));
    strip.setPixelColor(134, (strip.Color(255, 90, 0)));
    strip.setPixelColor(153, (strip.Color(255, 90, 0)));
    strip.setPixelColor(166, (strip.Color(255, 90, 0)));
    strip.setPixelColor(185, (strip.Color(255, 90, 0)));
    strip.setPixelColor(198, (strip.Color(255, 90, 0)));
    strip.setPixelColor(197, (strip.Color(255, 90, 0)));
    strip.setPixelColor(196, (strip.Color(255, 90, 0)));
    strip.setPixelColor(195, (strip.Color(255, 90, 0)));
    strip.setPixelColor(194, (strip.Color(255, 90, 0)));
    strip.setPixelColor(193, (strip.Color(255, 90, 0)));
    strip.setBrightness(bright);
    strip.show();

    delay(500);
    strip.clear();
    strip.show();
    delay(del1);
    strip.fill(strip.Color(255, 90, 0), 0, 256);
    strip.setBrightness(bright);
    strip.show();
    delay(del2);
    strip.clear();
    strip.show();
    delay(del2);
    strip.fill(strip.Color(255, 90, 0), 0, 256);
    strip.setBrightness(bright);
    strip.show();
    delay(del2);
    strip.clear();
    strip.show();
    delay(del2);
    strip.fill(strip.Color(255, 90, 0), 0, 256);
    strip.setBrightness(bright);
    strip.show();
    delay(500);
    strip.clear();
    strip.show();
    delay(del2);
  }
  else
  {
    strip.clear();
    strip.show();
  }





  if (digitalRead(SW_3) == HIGH)
  {

    strip.show();


    strip.setPixelColor(84, (strip.Color(139, 0, 139)));
    strip.setPixelColor(83, (strip.Color(139, 0, 139)));
    strip.setPixelColor(82, (strip.Color(139, 0, 139)));
    strip.setPixelColor(81, (strip.Color(139, 0, 139)));
    strip.setPixelColor(80, (strip.Color(139, 0, 139)));
    strip.setPixelColor(109, (strip.Color(139, 0, 139)));
    strip.setPixelColor(114, (strip.Color(139, 0, 139)));
    strip.setPixelColor(141, (strip.Color(139, 0, 139)));
    strip.setPixelColor(146, (strip.Color(139, 0, 139)));
    strip.setPixelColor(89, (strip.Color(139, 0, 139)));
    strip.setPixelColor(86, (strip.Color(139, 0, 139)));
    strip.setPixelColor(102, (strip.Color(139, 0, 139)));
    strip.setPixelColor(104, (strip.Color(139, 0, 139)));
    strip.setPixelColor(105, (strip.Color(139, 0, 139)));
    strip.setPixelColor(120, (strip.Color(139, 0, 139)));
    strip.setPixelColor(121, (strip.Color(139, 0, 139)));
    strip.setPixelColor(118, (strip.Color(139, 0, 139)));
    strip.setPixelColor(134, (strip.Color(139, 0, 139)));
    strip.setPixelColor(137, (strip.Color(139, 0, 139)));
    strip.setPixelColor(150, (strip.Color(139, 0, 139)));
    strip.setPixelColor(153, (strip.Color(139, 0, 139)));
    strip.setPixelColor(93, (strip.Color(139, 0, 139)));
    strip.setPixelColor(92, (strip.Color(139, 0, 139)));
    strip.setPixelColor(91, (strip.Color(139, 0, 139)));
    strip.setPixelColor(94, (strip.Color(139, 0, 139)));
    strip.setPixelColor(95, (strip.Color(139, 0, 139)));
    strip.setPixelColor(100, (strip.Color(139, 0, 139)));
    strip.setPixelColor(123, (strip.Color(139, 0, 139)));
    strip.setPixelColor(124, (strip.Color(139, 0, 139)));
    strip.setPixelColor(125, (strip.Color(139, 0, 139)));
    strip.setPixelColor(126, (strip.Color(139, 0, 139)));
    strip.setPixelColor(127, (strip.Color(139, 0, 139)));
    strip.setPixelColor(128, (strip.Color(139, 0, 139)));
    strip.setPixelColor(155, (strip.Color(139, 0, 139)));
    strip.setPixelColor(156, (strip.Color(139, 0, 139)));
    strip.setPixelColor(157, (strip.Color(139, 0, 139)));
    strip.setPixelColor(158, (strip.Color(139, 0, 139)));
    strip.setPixelColor(159, (strip.Color(139, 0, 139)));
    strip.setBrightness(bright);
    delay(del1);
    strip.show();
    strip.clear();
    delay(del1);
    strip.show();
    strip.setPixelColor(84, (strip.Color(139, 0, 139)));
    strip.setPixelColor(83, (strip.Color(139, 0, 139)));
    strip.setPixelColor(82, (strip.Color(139, 0, 139)));
    strip.setPixelColor(81, (strip.Color(139, 0, 139)));
    strip.setPixelColor(80, (strip.Color(139, 0, 139)));
    strip.setPixelColor(109, (strip.Color(139, 0, 139)));
    strip.setPixelColor(114, (strip.Color(139, 0, 139)));
    strip.setPixelColor(141, (strip.Color(139, 0, 139)));
    strip.setPixelColor(146, (strip.Color(139, 0, 139)));
    strip.setPixelColor(89, (strip.Color(139, 0, 139)));
    strip.setPixelColor(86, (strip.Color(139, 0, 139)));
    strip.setPixelColor(102, (strip.Color(139, 0, 139)));
    strip.setPixelColor(104, (strip.Color(139, 0, 139)));
    strip.setPixelColor(105, (strip.Color(139, 0, 139)));
    strip.setPixelColor(120, (strip.Color(139, 0, 139)));
    strip.setPixelColor(121, (strip.Color(139, 0, 139)));
    strip.setPixelColor(118, (strip.Color(139, 0, 139)));
    strip.setPixelColor(134, (strip.Color(139, 0, 139)));
    strip.setPixelColor(137, (strip.Color(139, 0, 139)));
    strip.setPixelColor(150, (strip.Color(139, 0, 139)));
    strip.setPixelColor(153, (strip.Color(139, 0, 139)));
    strip.setPixelColor(93, (strip.Color(139, 0, 139)));
    strip.setPixelColor(92, (strip.Color(139, 0, 139)));
    strip.setPixelColor(91, (strip.Color(139, 0, 139)));
    strip.setPixelColor(94, (strip.Color(139, 0, 139)));
    strip.setPixelColor(95, (strip.Color(139, 0, 139)));
    strip.setPixelColor(100, (strip.Color(139, 0, 139)));
    strip.setPixelColor(123, (strip.Color(139, 0, 139)));
    strip.setPixelColor(124, (strip.Color(139, 0, 139)));
    strip.setPixelColor(125, (strip.Color(139, 0, 139)));
    strip.setPixelColor(126, (strip.Color(139, 0, 139)));
    strip.setPixelColor(127, (strip.Color(139, 0, 139)));
    strip.setPixelColor(128, (strip.Color(139, 0, 139)));
    strip.setPixelColor(155, (strip.Color(139, 0, 139)));
    strip.setPixelColor(156, (strip.Color(139, 0, 139)));
    strip.setPixelColor(157, (strip.Color(139, 0, 139)));
    strip.setPixelColor(158, (strip.Color(139, 0, 139)));
    strip.setPixelColor(159, (strip.Color(139, 0, 139)));
    strip.setBrightness(bright);
    delay(del1);
    strip.show();
    strip.clear();
    delay(del1);
    strip.show();
    strip.setPixelColor(84, (strip.Color(139, 0, 139)));
    strip.setPixelColor(83, (strip.Color(139, 0, 139)));
    strip.setPixelColor(82, (strip.Color(139, 0, 139)));
    strip.setPixelColor(81, (strip.Color(139, 0, 139)));
    strip.setPixelColor(80, (strip.Color(139, 0, 139)));
    strip.setPixelColor(109, (strip.Color(139, 0, 139)));
    strip.setPixelColor(114, (strip.Color(139, 0, 139)));
    strip.setPixelColor(141, (strip.Color(139, 0, 139)));
    strip.setPixelColor(146, (strip.Color(139, 0, 139)));
    strip.setPixelColor(89, (strip.Color(139, 0, 139)));
    strip.setPixelColor(86, (strip.Color(139, 0, 139)));
    strip.setPixelColor(102, (strip.Color(139, 0, 139)));
    strip.setPixelColor(104, (strip.Color(139, 0, 139)));
    strip.setPixelColor(105, (strip.Color(139, 0, 139)));
    strip.setPixelColor(120, (strip.Color(139, 0, 139)));
    strip.setPixelColor(121, (strip.Color(139, 0, 139)));
    strip.setPixelColor(118, (strip.Color(139, 0, 139)));
    strip.setPixelColor(134, (strip.Color(139, 0, 139)));
    strip.setPixelColor(137, (strip.Color(139, 0, 139)));
    strip.setPixelColor(150, (strip.Color(139, 0, 139)));
    strip.setPixelColor(153, (strip.Color(139, 0, 139)));
    strip.setPixelColor(93, (strip.Color(139, 0, 139)));
    strip.setPixelColor(92, (strip.Color(139, 0, 139)));
    strip.setPixelColor(91, (strip.Color(139, 0, 139)));
    strip.setPixelColor(94, (strip.Color(139, 0, 139)));
    strip.setPixelColor(95, (strip.Color(139, 0, 139)));
    strip.setPixelColor(100, (strip.Color(139, 0, 139)));
    strip.setPixelColor(123, (strip.Color(139, 0, 139)));
    strip.setPixelColor(124, (strip.Color(139, 0, 139)));
    strip.setPixelColor(125, (strip.Color(139, 0, 139)));
    strip.setPixelColor(126, (strip.Color(139, 0, 139)));
    strip.setPixelColor(127, (strip.Color(139, 0, 139)));
    strip.setPixelColor(128, (strip.Color(139, 0, 139)));
    strip.setPixelColor(155, (strip.Color(139, 0, 139)));
    strip.setPixelColor(156, (strip.Color(139, 0, 139)));
    strip.setPixelColor(157, (strip.Color(139, 0, 139)));
    strip.setPixelColor(158, (strip.Color(139, 0, 139)));
    strip.setPixelColor(159, (strip.Color(139, 0, 139)));
    strip.setBrightness(bright);
    delay(del1);
    strip.show();
    strip.clear();
    delay(600);
    strip.show();

    strip.setPixelColor(84, (strip.Color(139, 0, 139)));
    strip.setPixelColor(83, (strip.Color(139, 0, 139)));
    strip.setPixelColor(82, (strip.Color(139, 0, 139)));
    strip.setPixelColor(81, (strip.Color(139, 0, 139)));
    strip.setPixelColor(80, (strip.Color(139, 0, 139)));
    strip.setPixelColor(107, (strip.Color(139, 0, 139)));
    strip.setPixelColor(111, (strip.Color(139, 0, 139)));
    strip.setPixelColor(112, (strip.Color(139, 0, 139)));
    strip.setPixelColor(116, (strip.Color(139, 0, 139)));
    strip.setPixelColor(139, (strip.Color(139, 0, 139)));
    strip.setPixelColor(143, (strip.Color(139, 0, 139)));
    strip.setPixelColor(144, (strip.Color(139, 0, 139)));
    strip.setPixelColor(145, (strip.Color(139, 0, 139)));
    strip.setPixelColor(146, (strip.Color(139, 0, 139)));
    strip.setPixelColor(147, (strip.Color(139, 0, 139)));
    strip.setPixelColor(148, (strip.Color(139, 0, 139)));
    strip.setPixelColor(89, (strip.Color(139, 0, 139)));
    strip.setPixelColor(87, (strip.Color(139, 0, 139)));
    strip.setPixelColor(86, (strip.Color(139, 0, 139)));
    strip.setPixelColor(88, (strip.Color(139, 0, 139)));
    strip.setPixelColor(102, (strip.Color(139, 0, 139)));
    strip.setPixelColor(105, (strip.Color(139, 0, 139)));
    strip.setPixelColor(121, (strip.Color(139, 0, 139)));
    strip.setPixelColor(118, (strip.Color(139, 0, 139)));
    strip.setPixelColor(134, (strip.Color(139, 0, 139)));
    strip.setPixelColor(137, (strip.Color(139, 0, 139)));
    strip.setPixelColor(150, (strip.Color(139, 0, 139)));
    strip.setPixelColor(151, (strip.Color(139, 0, 139)));
    strip.setPixelColor(152, (strip.Color(139, 0, 139)));
    strip.setPixelColor(153, (strip.Color(139, 0, 139)));
    strip.setPixelColor(93, (strip.Color(139, 0, 139)));
    strip.setPixelColor(98, (strip.Color(139, 0, 139)));
    strip.setPixelColor(125, (strip.Color(139, 0, 139)));
    strip.setPixelColor(130, (strip.Color(139, 0, 139)));
    strip.setPixelColor(157, (strip.Color(139, 0, 139)));
    strip.setBrightness(bright);
    delay(del2);
    strip.show();
    strip.clear();
    delay(del2);
    strip.show();

    strip.setPixelColor(84, (strip.Color(139, 0, 139)));
    strip.setPixelColor(83, (strip.Color(139, 0, 139)));
    strip.setPixelColor(82, (strip.Color(139, 0, 139)));
    strip.setPixelColor(81, (strip.Color(139, 0, 139)));
    strip.setPixelColor(107, (strip.Color(139, 0, 139)));
    strip.setPixelColor(110, (strip.Color(139, 0, 139)));
    strip.setPixelColor(113, (strip.Color(139, 0, 139)));
    strip.setPixelColor(116, (strip.Color(139, 0, 139)));
    strip.setPixelColor(139, (strip.Color(139, 0, 139)));
    strip.setPixelColor(142, (strip.Color(139, 0, 139)));
    strip.setPixelColor(145, (strip.Color(139, 0, 139)));
    strip.setPixelColor(146, (strip.Color(139, 0, 139)));
    strip.setPixelColor(147, (strip.Color(139, 0, 139)));
    strip.setPixelColor(148, (strip.Color(139, 0, 139)));
    strip.setPixelColor(89, (strip.Color(139, 0, 139)));
    strip.setPixelColor(87, (strip.Color(139, 0, 139)));
    strip.setPixelColor(86, (strip.Color(139, 0, 139)));
    strip.setPixelColor(88, (strip.Color(139, 0, 139)));
    strip.setPixelColor(102, (strip.Color(139, 0, 139)));
    strip.setPixelColor(105, (strip.Color(139, 0, 139)));
    strip.setPixelColor(121, (strip.Color(139, 0, 139)));
    strip.setPixelColor(118, (strip.Color(139, 0, 139)));
    strip.setPixelColor(134, (strip.Color(139, 0, 139)));
    strip.setPixelColor(137, (strip.Color(139, 0, 139)));
    strip.setPixelColor(150, (strip.Color(139, 0, 139)));
    strip.setPixelColor(151, (strip.Color(139, 0, 139)));
    strip.setPixelColor(152, (strip.Color(139, 0, 139)));
    strip.setPixelColor(153, (strip.Color(139, 0, 139)));
    strip.setPixelColor(93, (strip.Color(139, 0, 139)));
    strip.setPixelColor(98, (strip.Color(139, 0, 139)));
    strip.setPixelColor(125, (strip.Color(139, 0, 139)));
    strip.setPixelColor(130, (strip.Color(139, 0, 139)));
    strip.setPixelColor(157, (strip.Color(139, 0, 139)));
    strip.setBrightness(bright);
    delay(del2);
    strip.show();
    strip.clear();
    delay(del2);
    strip.show();

    strip.setPixelColor(84, (strip.Color(139, 0, 139)));
    strip.setPixelColor(83, (strip.Color(139, 0, 139)));
    strip.setPixelColor(82, (strip.Color(139, 0, 139)));
    strip.setPixelColor(81, (strip.Color(139, 0, 139)));
    strip.setPixelColor(107, (strip.Color(139, 0, 139)));
    strip.setPixelColor(110, (strip.Color(139, 0, 139)));
    strip.setPixelColor(113, (strip.Color(139, 0, 139)));
    strip.setPixelColor(116, (strip.Color(139, 0, 139)));
    strip.setPixelColor(139, (strip.Color(139, 0, 139)));
    strip.setPixelColor(142, (strip.Color(139, 0, 139)));
    strip.setPixelColor(145, (strip.Color(139, 0, 139)));
    strip.setPixelColor(146, (strip.Color(139, 0, 139)));
    strip.setPixelColor(147, (strip.Color(139, 0, 139)));
    strip.setPixelColor(148, (strip.Color(139, 0, 139)));
    strip.setPixelColor(89, (strip.Color(139, 0, 139)));
    strip.setPixelColor(87, (strip.Color(139, 0, 139)));
    strip.setPixelColor(86, (strip.Color(139, 0, 139)));
    strip.setPixelColor(88, (strip.Color(139, 0, 139)));
    strip.setPixelColor(102, (strip.Color(139, 0, 139)));
    strip.setPixelColor(105, (strip.Color(139, 0, 139)));
    strip.setPixelColor(121, (strip.Color(139, 0, 139)));
    strip.setPixelColor(118, (strip.Color(139, 0, 139)));
    strip.setPixelColor(134, (strip.Color(139, 0, 139)));
    strip.setPixelColor(137, (strip.Color(139, 0, 139)));
    strip.setPixelColor(150, (strip.Color(139, 0, 139)));
    strip.setPixelColor(151, (strip.Color(139, 0, 139)));
    strip.setPixelColor(152, (strip.Color(139, 0, 139)));
    strip.setPixelColor(153, (strip.Color(139, 0, 139)));
    strip.setPixelColor(93, (strip.Color(139, 0, 139)));
    strip.setPixelColor(98, (strip.Color(139, 0, 139)));
    strip.setPixelColor(125, (strip.Color(139, 0, 139)));
    strip.setPixelColor(130, (strip.Color(139, 0, 139)));
    strip.setPixelColor(157, (strip.Color(139, 0, 139)));
    strip.setBrightness(bright);
    delay(del2);
    strip.show();
    strip.clear();
    delay(600);


  }


  else
  {
    strip.clear();
    strip.show();
  }

  
 if (digitalRead(SW_4) == HIGH)
  {
    strip.fill(strip.Color(255, 255, 255), 0, 256);
    strip.setBrightness(bright);
    strip.show();
  }
  else
  {
    strip.clear();
    strip.show();
  }

}

It’s about time you read up on for() loops, and functions{}…

It will shorten and simplify your code by 90%

yes you have right.
But i dont know how :confused:

but that doesn't change anything about the flashing problem, does it?

It will make it easier to debug and fix…

but i don't know how to do it!

in my understanding it would be like that.

I write e.g. what happens with switch 1 on:
void switch1
{......... what should happen .....}

But then I don't know how to pass it on to the loop

if (digitalRead (SW_1) == HIGH)
{
void switch1
delay (del1);
strip.clear ();
strip.show ();
delay (del1);
void switch1
....etc. }
else {.. no idea}

Hi, @dope-walker
You might be better looking at the switch.. case function.
https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/

Tom... :smiley: :+1: :coffee: :australia:

The flashing problem is caused by the else statement, it is blanking the LEDs on everything that is not the chosen pattern from the if statement. So if the first case in not applicable but the second case is you turn all you LEDs off before you start on the second case.

but why does it work with the 3 switches / states as it should? Only the white that should shine permanently causes problems: /
if it is up to the else then it wouldn't work for all of them, would it?

Change that to:

  }
  else  if (digitalRead(SW_2) == HIGH)
  {

Change that to

  }
  else if (digitalRead(SW_3) == HIGH)
  {

Change that to:

  }
  else if (digitalRead(SW_4) == HIGH)
  {
1 Like

Wow!

Thank you!!!

Now it works :slight_smile:

So the problem is that, as I understand it, I always switched off the matrix after every switch and that causes problems ....
I did not know that. I thought I have to before something new comes up strip.clear (); write.

Yes, you were clearing the strip for each switch that was off. When one of the four switches was on you would display the pattern for that switch and then clear the strip three times (for the three switches that were off) before displaying that pattern again. The "if - else if - else if - else if - else" chain does the clearing of the strip only when all of the switches are off.

thank you for your explanation!!

and of course for your help :slight_smile:

so the problem is now solved :slight_smile:
Thanks to all for your answers! And your help!

now i have only one litle question left

How bright can the panel be at most?
at the moment I have a value of 0-64 using a potentiometer.

I dont know how high i can go i can find anything about that :frowning: but i'm afraid if it's too much the panel will break

I think the 'brightness' value can go up to 255. It should not harm the panel as long as the voltage you are feeding the panel is correct. You have not said what panel or what power supply you are using.

i have this panel

and this power supply

The display says "76.8 Watts" and the power supply says "75 Watts" so you should be able to use the display at full brightness (255) most of the time on most of the pixels. If you want to be safe, limit the brightness to 249.

thank you so much!!!!

yes the power supply is a little bit to low but i´m not a rich man :rofl: :rofl: :rofl: so this was for this project the maximum :see_no_evil:

i`m happy now it works well!!
thanks to your help :slight_smile:

But now I have to ask something else again: see_no_evil:

I did something wrong ...
But this time in the hardware.

Because I always overload the arduino and I have to unplug it and "restart". That happens when I want to make it brighter.

Is that really due to the dc dc converter? Because the number of amperes would fit exactly, only the wattage of 75 is 1.8W too little.
But that can't be such a problem, can it?
Do I have to connect it differently? Should I supply the arduino with power differently?
If yes how???

I connected it like this:

Yes.

You should NEVER run anything close to the limit of the rating. Never run it at more than 80% of the rating. This is called de-rating.

So no capacitor nor resistor. You are asking for trouble even if your power supply was adequate