Scroll a 5X5 LED matrix

Hello Arduino community. I have built a 5X5 LED matrix but have no idea on how to code a scrolling function. The matrix uses two 8 bit shift registers, One for the rows and one for the columns. it is also column scanned. I've been able to write a function to display a singular character and one to display all the characters in a message but just cant get it to scroll. I am not asking for someone to wright the code for me, but merely for guidance on how to approach writing a scroll function

Thanks in advance: Chris

The characters arry only has the letter A font put in, I haven't made the rest of the letters yet

//REV 1.0
//By: Christopher Beharry Yambo with help from the arduino community @www.forum.arduino.cc

/*
 * Controls a 5X5 LED matrix consisting of two 8bit shift registers
 * It's column scanned meaning that one column comes on at a time from left to right 
 * Hopefuly I can create scrolling in this first revision 
*/

//declaring constant ints for data, clock, and latch pins of the row and column registers
// both registers share the same latch pin
const int CPR = 8;
const int LP = 9;
const int DPR = 10;
const int CPC = 11;
const int DPC = 12;

byte columnActivator[5] = {B10000000, B01000000, B00100000, B00010000, B00001000}; 

//array that stores letters
byte characters[26][5] = {
  {B11111111, B00101000, B00101000, B00101000, B11111000},//0A
  {B11111000, B11110000, B11100000, B11000000, B10000000},//1B
  {B10000000, B10000000, B10000000, B10000000, B10000000},//2C
  {B10000000, B10000000, B10000000, B10000000, B10000000},//3D
  {B10000000, B10000000, B10000000, B10000000, B10000000},//4E
  {B10000000, B10000000, B10000000, B10000000, B10000000},//5F
  {B10000000, B10000000, B10000000, B10000000, B10000000},//6G
  {B10000000, B10000000, B10000000, B10000000, B10000000},//7H
  {B10000000, B10000000, B10000000, B10000000, B10000000},//8I
  {B10000000, B10000000, B10000000, B10000000, B10000000},//9J
  {B10000000, B10000000, B10000000, B10000000, B10000000},//10K
  {B10000000, B10000000, B10000000, B10000000, B10000000},//11L
  {B10000000, B10000000, B10000000, B10000000, B10000000},//12M
  {B10000000, B10000000, B10000000, B10000000, B10000000},//13N
  {B10000000, B10000000, B10000000, B10000000, B10000000},//14O
  {B10000000, B10000000, B10000000, B10000000, B10000000},//15P
  {B10000000, B10000000, B10000000, B10000000, B10000000},//16Q
  {B10000000, B10000000, B10000000, B10000000, B10000000},//17R
  {B10000000, B10000000, B10000000, B10000000, B10000000},//18S
  {B10000000, B10000000, B10000000, B10000000, B10000000},//19T
  {B10000000, B10000000, B10000000, B10000000, B10000000},//20U
  {B10000000, B10000000, B10000000, B10000000, B10000000},//21V
  {B10000000, B10000000, B10000000, B10000000, B10000000},//22W
  {B10000000, B10000000, B10000000, B10000000, B10000000},//23X
  {B10000000, B10000000, B10000000, B10000000, B10000000},//24Y
  {B10000000, B10000000, B10000000, B10000000, B10000000},//25Z
};


void setup() {
  Serial.begin(9600);

  //initializes pins as outputs
  for(int A=8; A<=12; A++)
  {
    pinMode(A, OUTPUT);
  }
}

void loop() {
  show("A B");
}

//function to show a singular character from the letter array
void showCharacter(int outputCharacter) {
  int letter = (outputCharacter - 65);
  for(int B=0; B<5; B++)
  {
    digitalWrite(LP, LOW);
    shiftOut(DPC, CPC, LSBFIRST, columnActivator[B]);
    shiftOut(DPR, CPR, LSBFIRST, characters[letter][B]);
    digitalWrite(LP, HIGH);
  }
}

//function to show a message with a delay between each character
void show(String message) {
  int characterDelay = 650;
  for(int C=0; C<message.length(); C++)
  {
    int character = message.charAt(C);
    unsigned long timer = millis();
    while((characterDelay + timer) > millis())
    {
      
      //if theres a space in the message all 0's are shifted out
      if(character == 32)
      {        
        digitalWrite(LP, LOW);
        shiftOut(DPC, CPC, LSBFIRST, B00000000);
        shiftOut(DPR, CPR, LSBFIRST, B00000000);
        digitalWrite(LP, HIGH);        
      }

      //otherwise the correct letter is shifted out
      else
      {
        showCharacter(character);
      }
    }
  }
  
}


//function to scroll a message
void scroll(String message) {

  
}

Put your message in a large horizantal array, and pull out bytes 5 at a time every 50 to 100mS to display: 0-4, 1-5, 2-6, 3-7, 4-8, 5-9, 6-10, etc.

If you store the message in EEPROM, it can be really long, and user changeable.

Are you saying to store it in EEPROM because when i place the message in an array it will be automatically stored there? Or are you saying to store it in EEPROM because it's something I'd have to manually do?

Also, I just made a scroll function using the method you said to and i thought it would work perfectly but for some reason the rightmost column of the matrix displays what its supposed to and all the LED's to the left of that just flash very quick. In the void scroll function in the code below i commented out 2 serial.println commands but when un-commented they display what they're supposed to just one time and all at once, then they wait the 350 ms delay and do it again. What they're supposed to be doing is constantly displaying those numbers, not showing them all at once for one second then outputting nothing. If you run the code and un-comment the lines I'm talking about it should make more sense when you look at the serial monitor. Any help would be appreciated.

//REV 1.0
//By: Christopher Beharry Yambo with help from the arduino community @www.forum.arduino.cc

/*
 * Controls a 5X5 LED matrix consisting of two 8bit shift registers
 * It's column scanned meaning that one column comes on at a time from left to right 
 * Hopefuly I can create scrolling in this first revision 
*/

//declaring constant ints for data, clock, and latch pins of the row and column registers
// both registers share the same latch pin
const int CPR = 8;
const int LP = 9;
const int DPR = 10;
const int CPC = 11;
const int DPC = 12;

byte columnActivator[5] = {B10000000, B01000000, B00100000, B00010000, B00001000}; 
//byte scrollActivator[5] = {B00001000, B00011000, B00111000, B01111000, B11111000};
//array that stores letters
byte characters[26][5] = {
  {B11111000, B00101000, B00101000, B00101000, B11111000},//0A
  {B11111000, B11110000, B11100000, B11000000, B10000000},//1B
  {B10000000, B10000000, B10000000, B10000000, B10000000},//2C
  {B10000000, B10000000, B10000000, B10000000, B10000000},//3D
  {B10000000, B10000000, B10000000, B10000000, B10000000},//4E
  {B10000000, B10000000, B10000000, B10000000, B10000000},//5F
  {B10000000, B10000000, B10000000, B10000000, B10000000},//6G
  {B10000000, B10000000, B10000000, B10000000, B10000000},//7H
  {B10000000, B10000000, B10000000, B10000000, B10000000},//8I
  {B10000000, B10000000, B10000000, B10000000, B10000000},//9J
  {B10000000, B10000000, B10000000, B10000000, B10000000},//10K
  {B10000000, B10000000, B10000000, B10000000, B10000000},//11L
  {B10000000, B10000000, B10000000, B10000000, B10000000},//12M
  {B10000000, B10000000, B10000000, B10000000, B10000000},//13N
  {B10000000, B10000000, B10000000, B10000000, B10000000},//14O
  {B10000000, B10000000, B10000000, B10000000, B10000000},//15P
  {B10000000, B10000000, B10000000, B10000000, B10000000},//16Q
  {B10000000, B10000000, B10000000, B10000000, B10000000},//17R
  {B10000000, B10000000, B10000000, B10000000, B10000000},//18S
  {B10000000, B10000000, B10000000, B10000000, B10000000},//19T
  {B10000000, B10000000, B10000000, B10000000, B10000000},//20U
  {B10000000, B10000000, B10000000, B10000000, B10000000},//21V
  {B10000000, B10000000, B10000000, B10000000, B10000000},//22W
  {B10000000, B10000000, B10000000, B10000000, B10000000},//23X
  {B10000000, B10000000, B10000000, B10000000, B10000000},//24Y
  {B10000000, B10000000, B10000000, B10000000, B10000000},//25Z
};

//limited to 160 characters for scroll funtion message unless you change array size
byte scrollArray [160];


void setup() {
  Serial.begin(9600);

  //initializes pins as outputs
  for(int A=8; A<=12; A++)
  {
    pinMode(A, OUTPUT);
  }
}

void loop() {
  scroll("AB");
}

//function to show a singular character from the letter array
void showCharacter(int outputCharacter) {
  int letter = (outputCharacter - 65);
  for(int B=0; B<5; B++)
  {
    digitalWrite(LP, LOW);
    shiftOut(DPC, CPC, LSBFIRST, columnActivator[B]);
    shiftOut(DPR, CPR, LSBFIRST, characters[letter][B]);
    digitalWrite(LP, HIGH);
  }
}

//function to show a message with a delay between each character
void show(String message) {
  int characterDelay = 650;
  for(int C=0; C<message.length(); C++)
  {
    int character = message.charAt(C);
    unsigned long timer = millis();
    while((characterDelay + timer) > millis())
    {
      
      //if theres a space in the message all 0's are shifted out
      if(character == 32)
      {        
        digitalWrite(LP, LOW);
        shiftOut(DPC, CPC, LSBFIRST, B00000000);
        shiftOut(DPR, CPR, LSBFIRST, B00000000);
        digitalWrite(LP, HIGH);        
      }

      //otherwise the correct letter is shifted out
      else
      {
        showCharacter(character);
      }
    }
  } 
}


//function to scroll a message
void scroll(String message) {
  //places the message into one long array
  int messageLength = message.length();
  for(int D=0; D<messageLength; D++)
  {
    for(int E=0; E<5; E++)
    {
      scrollArray[(D*5) + E] = characters[(message.charAt(D)) - 'A'][E];
    }
  }

  //scrolls out scroll array
  int X=0;
  int Y=4;
  int Z=0;
  for(int F=0; F<(messageLength*5); F++)
  {
    int shiftDelay = 350;
    int timer = millis();
    while((timer + shiftDelay)>millis());
    {
      for(int G=X; G<=Y; G++)
      {        
        digitalWrite(LP, LOW);
        shiftOut(DPC, CPC, LSBFIRST, columnActivator[Z]);
        shiftOut(DPR, CPR, LSBFIRST, scrollArray[G]);
        digitalWrite(LP, HIGH);
        if(Z==4)
        {
          Z=0;
        }
        else
        {
          Z++;
        }
        //Serial.println(G);
        //Serial.println(Z);        
      }
    }
    Y++;
    X++;
  }
}