Led Matrix 5x7 Scrolling Text

Hello

I want to make a (scrolling) text led matrix. I connected the wires on my Arduino Nano. I have tried several codes, but they didn't work.

I want to run the code from http://www.local-guru.net/blog/2009/04/03/5x7-led-matrix-on-my-arduino, but they are all lit at a certain brightness, with a certain flicker. I use this led matrix http://www.farnell.com/datasheets/1631380.pdf

I added some comments. This is the code. I don't know exaclty what's going on in the code. I found some info on Arduino Playground - BitMath

// Datasheet and ledmatrix I used
//http://www.farnell.com/datasheets/1631380.pdf
//Source: http://www.local-guru.net/blog/2009/04/03/5x7-led-matrix-on-my-arduino


/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
---Scematic of led matrix---
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The numbers are the pins of the led matrix. The "O" are the leds.

  14 13  12  11  10 9 8 
   O   O   O   O   O
   O   O   O   O   O
   O   O   O   O   O
   O   O   O   O   O
   O   O   O   O   O
  1  2  3  4  5  6  7 

%%%%%%%%%%%%
---Wiring---
%%%%%%%%%%%%
This is the syntax:
==> Arduino Digital OUT | MATRIX Pin in (row/column *number*) <==
2|9 (row 1)
3|14 (row 2)
4|8 (row 3)
5|12 OR 5, they're connected! (row 4)
6|1 (row 5)
7|7 (row 6)
8|2 (row 7)
9|13 (col 1)
10|3 (col 2)
11|4 OR 11, they're connected!(col 3)
12|10 (col 4)
13|6 (col 5)

You have to connect for example pin 2 with pin 9 of the led matrix (watch the diagram), that's the second from right
*/

int index = 0;

unsigned long last;


//%%%%%%%%%%%%
//---Setup---
//%%%%%%%%%%%%

void setup() {
  last = millis();
  //These are the columns
  pinMode( 9, OUTPUT );
  pinMode( 10, OUTPUT );
  pinMode( 11, OUTPUT );
  pinMode( 12, OUTPUT );
  pinMode( 13, OUTPUT );

  //These are the rows
  pinMode( 2, OUTPUT );
  pinMode( 3, OUTPUT );
  pinMode( 4, OUTPUT );
  pinMode( 5, OUTPUT );
  pinMode( 6, OUTPUT );
  pinMode( 7, OUTPUT );
  pinMode( 8, OUTPUT );

  //Set every row to low
  for( int r = 0; r < 7; r++) {
     digitalWrite( r + 2, LOW );
   }
   //We have 7 rows so, 0->7
   //We start at pin 2, so you have to add 2
   
   //Set every column to low
   for( int c = 0; c < 5; c++) {
     digitalWrite( c + 9, HIGH);
   }
   //We have 9 columns so, 0->9
   //We start at pin 9, so you have to add 9
}

byte leds[7][5]; 

void setPattern( byte pattern[20][5], int index ) {
  for( int r =0; r < 7; r++) {
    for( int c = 0; c < 5; c++) {
      leds[r][c] = pattern[r + index][c];
     }
   } 
}

void draw() {   

  for( int r =0; r < 7; r ++ ) {
    digitalWrite( r + 2, HIGH );
    for( int c=0; c < 5; c ++ ) {
      digitalWrite( 13 - c, ( leds[r][c] == 1 ? LOW : HIGH ));
    }
    delayMicroseconds(900);
    digitalWrite( r + 2, LOW );
  }
}

void loop() {
  if ( millis() - last > 400 ) {
    index = (index == 0 ?  7 : 0);
    last = millis();
  }

  byte tmp[14][5] = {
  { 0,0,0,0,0},
  { 0,1,0,1,0},
  { 0,0,0,0,0},
  { 0,1,1,1,0},
  { 0,1,0,1,0},
  { 0,1,1,1,0},
  { 0,0,0,0,0},

  { 0,0,0,0,0},
  { 0,1,0,1,0},
  { 0,0,0,0,0},
  { 0,0,0,0,0},
  { 0,1,1,1,0},
  { 0,0,0,0,0},
  { 0,0,0,0,0},
  };

  setPattern( tmp, index );
  draw();
}

Does someone know, what i'm doing wrong?

Kind regards