POV Sketch not working

I've been coding around a bit while trying to make a POV.
It's 15 led's wide.

This is my code:

const byte d0[14] = {
  B00111111, B1111100,
  B01111111, B1111110,
  B11000000, B0000011,
  B11000000, B0000011,
  B11000000, B0000011,
  B01111111, B1111110,
  B00111111, B1111100
};
const byte d1[14] = {
  B11000000, B0000000,
  B11000000, B0001100,
  B11000000, B0001110,
  B11111111, B1111111,
  B11000000, B0000000,
  B11000000, B0000000,
  B11000000, B0000000
};
const byte d2[14] = {
  B11000000, B0111100,
  B11100000, B0111110,
  B11110000, B0000111,
  B11011000, B0000011,
  B11001100, B0000111,
  B11000111, B1111110,
  B11000001, B1111100
};
const byte d3[14] = {
  B00111000, B0011100,
  B01111000, B0011110,
  B11100000, B0000111,
  B11000001, B0000011,
  B11100011, B1000111,
  B01111110, B1111110,
  B00111100, B0111100
};
const byte d4[14] = {
  B00001110, B0000000,
  B00001111, B1000000,
  B00001100, B1110000,
  B00001100, B0011100,
  B11111111, B1111111,
  B11111111, B1111111,
  B00001100, B0000000
}; 
const byte d5[14] = {
  B00111001, B1111111,
  B01111001, B1111111,
  B11100001, B1000011,
  B11000001, B1000011,
  B11100001, B1000011,
  B01111111, B1000011,
  B00111111, B1000011
};
const byte d6[14] = {
  B00111111, B1111100,
  B01111111, B1111110,
  B11100111, B1000111,
  B11000011, B1000011,
  B11100111, B1000111,
  B01111110, B0001110,
  B00111100, B0011100
};
const byte d7[14] = {
  B00000000, B0000011,
  B11000000, B0000011,
  B01111000, B0000011,
  B00001111, B0000011,
  B00000001, B1111011,
  B00000000, B0011111,
  B00000000, B0000011
};
const byte d8[14] = {
  B00111100, B0111100,
  B01111110, B1111110,
  B11100011, B1000111,
  B11000001, B0000011,
  B11100011, B1000111,
  B01111110, B1111110,
  B00111100, B0111100
};
const byte d9[14] = {
  B00111000, B0111100,
  B01110000, B1111110,
  B11100011, B1100111,
  B11000011, B1000011,
  B11100011, B1100111,
  B01111111, B1111110,
  B00111111, B1111100
};
const byte dots[14] = {
  B00000000, B0000000,
  B00000000, B0000000,
  B00001000, B0010000,
  B00011100, B0111000,
  B00001000, B0010000,
  B00000000, B0000000,
  B00000000, B0000000
};

byte pins[15] = {
  14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};

byte povlength = 15;

void setup() {
  for(int i = 0; i < povlength; i++) {
    pinMode(pins[i], OUTPUT);
  }
}

void loop() {
  digit_out(4);
  delay(1000);
}

void digit_out(int which) {
 switch(which) {
     case 0:
        out(d0);
        break;
     case 1:
        out(d1);
        break;
     case 2:
        out(d2);
        break;
     case 3:
        out(d3);
        break;
     case 4:
        out(d4);
        break;
     case 5:
        out(d5);
        break;
     case 6:
        out(d6);
        break;
     case 7:
        out(d7);
        break;
     case 8:
        out(d8);
        break;
     case 9:
        out(d9);
        break;
  } 
}

void out(const byte *data) {
  for (byte x=0; x<14; x+=2) {
    column(data[x+1], data[x]);
    delayMicroseconds(100);
  }
  column(B00000000, B0000000);
}

void column(byte data, byte data2) {
  for (byte y=0; y<8; y++) {
    digitalWrite(pins[y], data & (1<<y));
  }
  for (byte y=0; y<8; y++) {
    digitalWrite(pins[y+7], data2 & (1<<y));
  }
}

But it doesn't seems to work! My lights light up very randomly and definitely not as the are supposed to.

But when I remove some statements in the switch-case digit_out function, it does work? So it seams to freak out while using more digits/chars.
I commented out everything above 6 in the code below, if I want to use like say number 7, it starts to freak out.

void digit_out(int which) {
 switch(which) {
     case 0:
        out(d0);
        break;
     case 1:
        out(d1);
        break;
     case 2:
        out(d2);
        break;
     case 3:
        out(d3);
        break;
     case 4:
        out(d4);
        break;
     case 5:
        out(d5);
        break;
     case 6:
        out(d6);
        break;
     /*case 7:
        out(d7);
        break;
     case 8:
        out(d8);
        break;
     case 9:
        out(d9);
        break;*/
  } 
}

What can be the problem?

Count how many pin numbers are in your pins array. Compare that to the value of povlength. Explain the difference.

What Arduino is this code for?

I commented out everything above 6 in the code below, if I want to use like say number 7, it starts to freak out.

What happens if you comment out 0 to 4, instead?

Aside: For a POV display, you'll want to turn the LEDs on and off faster than digitalWrite() is able to. You'll need to look into direct port manipulation to get the required speed. Unfortunately, that will leave you with non-portable code, but, perhaps that is not all that important to you.

Ah about the first thing, I forgot to put pin 0 in the array. That's fixed. But it doesn't fix the problem.
About the second thing. I also tried commenting out the 1 till 4, and then everything above it worked.
So it just depends of the amount of 'digits' :grin:

But problem not solved yet, it still freaks out when using more then 7 'digits' :relaxed: