Arduino code for LEDs with an Input and array sequences

I need help with a little school project. I made the code, it worked, I tried to make it shorter but then it stopped reacting. What I expected to happen is by pressing the letter, related to the sequence in the Serial Monitor, it would start flickering the lights in a pattern. The problem I have now, is when I type a letter in the serial monitor console it doesn't light any LEDs nor does it give me any printlns (like "invalid input" . Here is my code:
PS: I have tried using replace all twice, but i think i fixed that. I just can't see what the problem is at the moment.

const int DELAYTIME = 100;
const int NUMBEROFPINS = 8;
const int NUMBEROFSEQUENCES= 15;
const int NUMBEROFpatternS = 8;
const int pinArray[NUMBEROFPINS] = {13, 12, 11, 10, 9, 8, 7, 6};
const int LEDsequence [NUMBEROFpatternS][NUMBEROFSEQUENCES][NUMBEROFPINS] = {
  {     //pattern 0         
  {1,0,0,0,0,0,0,0},
  {0,1,0,0,0,0,0,0},
  {0,0,1,0,0,0,0,0},
  {0,0,0,1,0,0,0,0},
  {0,0,0,0,1,0,0,0},
  {0,0,0,0,0,1,0,0},
  {0,0,0,0,0,0,1,0},
  {0,0,0,0,0,0,0,1}
  },
  {     //pattern 1         
  {1,0,0,0,0,0,0,1},
  {0,1,0,0,0,0,1,0},
  {0,0,1,0,0,1,0,0},
  {0,0,0,1,1,0,0,0},
  {0,0,0,1,1,0,0,0},
  {0,0,1,0,0,1,0,0},
  {0,1,0,0,0,0,1,0},
  {1,0,0,0,0,0,0,1}
  },
  {     //pattern 2         
  {0,1,1,1,1,1,1,1},
  {1,0,1,1,1,1,1,1},
  {1,1,0,1,1,1,1,1},
  {1,1,1,0,1,1,1,1},
  {1,1,1,1,0,1,1,1},
  {1,1,1,1,1,0,1,1},
  {1,1,1,1,1,1,0,1},
  {1,1,1,1,1,1,1,0},
  {1,1,1,1,1,1,0,1},
  {1,1,1,1,1,0,1,1},
  {1,1,1,1,0,1,1,1},
  {1,1,1,0,1,1,1,1},
  {1,1,0,1,1,1,1,1},
  {1,0,1,1,1,1,1,1},
  {0,1,1,1,1,1,1,1},  
  },
  {     //pattern 3         
  {1,0,0,0,0,0,0,1},
  {1,1,0,0,0,0,1,1},
  {1,1,1,0,0,1,1,1},
  {1,1,1,1,1,1,1,1}
  },
  {     //pattern 4         
  {1,0,0,0,0,0,0,0},
  {1,1,0,0,0,0,0,0},
  {1,1,1,0,0,0,0,0},
  {1,1,1,1,0,0,0,0},
  {1,1,1,1,1,0,0,0},
  {1,1,1,1,1,1,0,0},
  {1,1,1,1,1,1,1,0},
  {1,1,1,1,1,1,1,1}
  },
  {     //pattern 5         
  {0,0,0,0,0,0,0,1},
  {0,0,0,0,0,0,1,1},
  {0,0,0,0,0,1,1,1},
  {0,0,0,0,1,1,1,1},
  {0,0,0,1,1,1,1,1},
  {0,0,1,1,1,1,1,1},
  {0,1,1,1,1,1,1,1},
  {1,1,1,1,1,1,1,1}
  },
  {     //pattern 6         
  {0,0,0,0,0,0,0,0}
},
  {     //pattern 7         
  {0,1,1,1,1,1,1,1},
  {1,0,1,1,1,1,1,1},
  {1,1,0,1,1,1,1,1},
  {1,1,1,0,1,1,1,1},
  {1,1,1,1,0,1,1,1},
  {1,1,1,1,1,0,1,1},
  {1,1,1,1,1,1,0,1},
  {1,1,1,1,1,1,1,0},
  {1,1,1,1,1,1,0,1},
  {1,1,1,1,1,0,1,1},
  {1,1,1,1,0,1,1,1},
  {1,1,1,0,1,1,1,1},
  {1,1,0,1,1,1,1,1},
  {1,0,1,1,1,1,1,1},
  {0,1,1,1,1,1,1,1},  
  }
};
int pattern = 6;

void setup(){
    Serial.begin(9600);
  for (int pin=0;pin<NUMBEROFPINS;pin++) {
    pinMode(pinArray[pin], OUTPUT);     // we make all the declarations at once
  };
}

void loop() {
  char incomingByte;
  for (int sequence=0;sequence<NUMBEROFSEQUENCES;sequence++) {
    for (int pin=0;pin<NUMBEROFPINS;pin++) {
     digitalWrite(pinArray[pin], LEDsequence[pattern][sequence][pin]);
    }  
   delay(DELAYTIME);
   if (Serial.available() > 0){
     incomingByte = Serial.read();
   switch (incomingByte){
     case 72: pattern = 7; // is een 'H'
   break;
     case 104: pattern = 2; // is een 'h'
   break;
        case 83: pattern = 1; // is een 'S'
   break;
        case 115: pattern = 3; // is een 's'
   break;
        case 82: pattern = 4; // is een 'R'
   break;
        case 76: pattern = 5; // is een 'L'
   break;
        case 69: pattern = 6; // is een 'E'
   break;
        case 65: pattern = 0; // is een 'A'
   break;
    default: 
      pattern = 6;
      Serial.println("Invalid input");
      break;
   }
 }
}
}

Isn't

        case 'H': pattern = 7;

so much easier to read?

Using 1920 bytes of memory that you may not have may also not be a great idea.const byte LEDsequence [NUMBEROFpatternS][NUMBEROFSEQUENCES][NUMBEROFPINS] = {will halve that, but bit-packing will help still further.

Thanks AWOL, I wasn't sure if the way I coded it it would read 'H' instead of 72. And the reason why I use int ledSequence instead of byte, is because we got an example code, and had to expand upon that and make extra patterns:

const int DELAYTIME = 100;
const int NUMBEROFPINS = 8;
const int NUMBEROFSEQUENCES= 8;
const int NUMBEROFPATTERNS = 2;
const int pinArray[NUMBEROFPINS] = {13, 12, 11, 10, 9, 8, 7, 6};
const int LEDsequence [NUMBEROFPATTERNS][NUMBEROFSEQUENCES][NUMBEROFPINS] = {
  {
  {1,0,0,0,0,0,0,0},
  {0,1,0,0,0,0,0,0},
  {0,0,1,0,0,0,0,0},
  {0,0,0,1,0,0,0,0},
  {0,0,0,0,1,0,0,0},
  {0,0,0,0,0,1,0,0},
  {0,0,0,0,0,0,1,0},
  {0,0,0,0,0,0,0,1}
  },
  {
  {1,0,0,0,0,0,0,1},
  {0,1,0,0,0,0,1,0},
  {0,0,1,0,0,1,0,0},
  {0,0,0,1,1,0,0,0},
  {0,0,0,1,1,0,0,0},
  {0,0,1,0,0,1,0,0},
  {0,1,0,0,0,0,1,0},
  {1,0,0,0,0,0,0,1}
  }
};
int pattern = 0;

void setup(){
  for (int pin=0;pin<NUMBEROFPINS;pin++) {
    pinMode(pinArray[pin], OUTPUT);     // we make all the declarations at once
  };
  Serial.begin(9600);
}

void loop() {
  int incomingByte;
  for (int sequence=0;sequence<NUMBEROFSEQUENCES;sequence++) {
    for (int pin=0;pin<NUMBEROFPINS;pin++) {
     digitalWrite(pinArray[pin], LEDsequence[pattern][sequence][pin]);
    }  
   delay(DELAYTIME);
   if (Serial.available() > 0){
     incomingByte = Serial.read();
     if (incomingByte == 0x41){ // is een 'A'
       pattern = 0;}
     else {
       pattern = 1;}
   }
 }
}

I found the problem. I had 2 patterns identically the same, I changed

const int NUMBEROFPATTERNS = 7;

to =8;

and I removed the last pattern i had (the double one):

  {     //pattern 7         
  {0,1,1,1,1,1,1,1},
  {1,0,1,1,1,1,1,1},
  {1,1,0,1,1,1,1,1},
  {1,1,1,0,1,1,1,1},
  {1,1,1,1,0,1,1,1},
  {1,1,1,1,1,0,1,1},
  {1,1,1,1,1,1,0,1},
  {1,1,1,1,1,1,1,0},
  {1,1,1,1,1,1,0,1},
  {1,1,1,1,1,0,1,1},
  {1,1,1,1,0,1,1,1},
  {1,1,1,0,1,1,1,1},
  {1,1,0,1,1,1,1,1},
  {1,0,1,1,1,1,1,1},
  {0,1,1,1,1,1,1,1},  
  }

And in the Switch Case I made comments:

// case 'A': pattern = 0; // is een 'A'
//   break;

So it's solved now :smiley:

And the reason why I use int ledSequence instead of byte, is because we got an example code, and had to expand upon that and make extra patterns:

But you also expanded the amount of RAM the tables took up, which is why I suggested changing the type to "byte" from "int".
RAM is very precious on a microcontroller, and using 16 bits of RAM to hold 1 bit of data is foolish.
(actually, using any RAM to hold constant data is equally foolish)

Oooh like that. Okay, I'll ask the teacher about it then and I'll make the same program with byte instead of int.
And for those interested this is my "final" code:

const int DELAYTIME = 100;
const int NUMBEROFPINS = 8;
const int NUMBEROFSEQUENCES= 15;
const int NUMBEROFPATTERNS = 7;
const int pinArray[NUMBEROFPINS] = {13, 12, 11, 10, 9, 8, 7, 6};
const int LEDsequence [NUMBEROFPATTERNS][NUMBEROFSEQUENCES][NUMBEROFPINS] = {
  {     //pattern 0 = H       
  {1,0,0,0,0,0,0,0},
  {0,1,0,0,0,0,0,0},
  {0,0,1,0,0,0,0,0},
  {0,0,0,1,0,0,0,0},
  {0,0,0,0,1,0,0,0},
  {0,0,0,0,0,1,0,0},
  {0,0,0,0,0,0,1,0},
  {0,0,0,0,0,0,0,1},
  {0,0,0,0,0,0,1,0},
  {0,0,0,0,0,1,0,0},
  {0,0,0,0,1,0,0,0},
  {0,0,0,1,0,0,0,0},
  {0,0,1,0,0,0,0,0},
  {0,1,0,0,0,0,0,0},
  {1,0,0,0,0,0,0,0}  
  },
  {     //pattern 1         
  {1,0,0,0,0,0,0,1},
  {0,1,0,0,0,0,1,0},
  {0,0,1,0,0,1,0,0},
  {0,0,0,1,1,0,0,0},
  {0,0,0,1,1,0,0,0},
  {0,0,1,0,0,1,0,0},
  {0,1,0,0,0,0,1,0},
  {1,0,0,0,0,0,0,1}
  },
  {     //pattern 2         
  {0,1,1,1,1,1,1,1},
  {1,0,1,1,1,1,1,1},
  {1,1,0,1,1,1,1,1},
  {1,1,1,0,1,1,1,1},
  {1,1,1,1,0,1,1,1},
  {1,1,1,1,1,0,1,1},
  {1,1,1,1,1,1,0,1},
  {1,1,1,1,1,1,1,0},
  {1,1,1,1,1,1,0,1},
  {1,1,1,1,1,0,1,1},
  {1,1,1,1,0,1,1,1},
  {1,1,1,0,1,1,1,1},
  {1,1,0,1,1,1,1,1},
  {1,0,1,1,1,1,1,1},
  {0,1,1,1,1,1,1,1}  
  },
  {     //pattern 3         
  {1,0,0,0,0,0,0,1},
  {1,1,0,0,0,0,1,1},
  {1,1,1,0,0,1,1,1},
  {1,1,1,1,1,1,1,1}
  },
  {     //pattern 4         
  {1,0,0,0,0,0,0,0},
  {1,1,0,0,0,0,0,0},
  {1,1,1,0,0,0,0,0},
  {1,1,1,1,0,0,0,0},
  {1,1,1,1,1,0,0,0},
  {1,1,1,1,1,1,0,0},
  {1,1,1,1,1,1,1,0},
  {1,1,1,1,1,1,1,1}
  },
  {     //pattern 5         
  {0,0,0,0,0,0,0,1},
  {0,0,0,0,0,0,1,1},
  {0,0,0,0,0,1,1,1},
  {0,0,0,0,1,1,1,1},
  {0,0,0,1,1,1,1,1},
  {0,0,1,1,1,1,1,1},
  {0,1,1,1,1,1,1,1},
  {1,1,1,1,1,1,1,1}
  },
  {     //pattern 6         
  {0,0,0,0,0,0,0,0}
}
};
int pattern = 6;

void setup(){
  for (int pin=0;pin<NUMBEROFPINS;pin++) {
    pinMode(pinArray[pin], OUTPUT);     // we make all the declarations at once
  };
  Serial.begin(9600);
}

void loop() {
  char incomingByte;
  for (int sequence=0;sequence<NUMBEROFSEQUENCES;sequence++) {
    for (int pin=0;pin<NUMBEROFPINS;pin++) {
     digitalWrite(pinArray[pin], LEDsequence[pattern][sequence][pin]);
    }  
   delay(DELAYTIME);
   if (Serial.available() > 0){
     incomingByte = Serial.read();
        switch (incomingByte){
     case 'H': pattern = 0; // is een 'H'
           Serial.println("Pattern 0");
   break;
     case 'h': pattern = 2; // is een 'h'
           Serial.println("Pattern 1");
   break;
        case 'S': pattern = 1; // is een 'S'
           Serial.println("Pattern 2");
   break;
        case 's': pattern = 3; // is een 's'
           Serial.println("Pattern 3");
   break;
        case 'R': pattern = 4; // is een 'R'
          Serial.println("Pattern 4");       
   break;
        case 'L': pattern = 5; // is een 'L'
          Serial.println("Pattern 5");
   break;
        case 'E': pattern = 6; // is een 'E'
          Serial.println("Pattern Off");
   break;
    default: 
      pattern = 6;
      Serial.println("Invalid input");
      break;
   }
 }
}
}

I found the problem. I had 2 patterns identically the same

The problem was not (directly) that you had a repeated pattern (the compiler doesn't care), it was that the patterns you had used too much RAM.
8 x 8 x 15 x 2 = 1920 bytes originally
vs.
8 x 7 x 15 x 2 = 1680 bytes now.

But you really only need 210 bytes, and that doesn't need to be in RAM.