as other said, a 2D array could help
const byte dataPin = 11;
const byte clockPin = 12;
const byte latchPin = 8;
byte ledPatterns[41][5] = {
{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}, // place holders as you don't seem to have those
{0,0,4,0,0},{0,0,8,0,0},{0,0,16,0,0},{0,0,32,0,0},{0,0,64,0,0},
{0,0,128,0,0},{0,0,0,0,1},{0,0,0,0,2},{0,0,0,0,4},{0,0,0,0,8},
{0,0,0,0,16},{0,0,0,0,32},{0,4,0,0,0},{0,8,0,0,0},{0,0,0,0,64},
{0,0,0,0,128},{0,0,0,1,0},{0,0,0,2,0},{0,16,0,0,0},{0,32,0,0,0},
{0,64,0,0,0},{0,128,0,0,0},{0,0,0,4,0},{0,0,0,8,0},{0,0,0,16,0},
{0,0,0,32,0},{1,0,0,0,0},{2,0,0,0,0},{4,0,0,0,0},{8,0,0,0,0},
{0,0,0,64,0},{0,0,0,128,0},{0,0,1,0,0},{0,0,2,0,0},{16,0,0,0,0},
{32,0,0,0,0}
};
// shadow array holds current state of all 5 shift registers
byte shadow[5] = {0,0,0,0,0};
void setLED(int pinNumber, bool state) {
for(int i = 0; i < 5; i++) {
if(state) shadow[i] |= ledPatterns[pinNumber][i];
else shadow[i] &= ~ledPatterns[pinNumber][i];
}
digitalWrite(latchPin, LOW);
for(int i = 0; i < 5; i++) {
shiftOut(dataPin, clockPin, MSBFIRST, shadow[i]);
}
digitalWrite(latchPin, HIGH);
}
void setup() {
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
}
void loop() {
setLED(5, HIGH);
delay(500);
setLED(5, LOW);
delay(500);
setLED(7, HIGH);
delay(500);
setLED(7, LOW);
delay(500);
}