Ethernet & Matrix help

I'm trying to create a sketch that gets a request from a browser and displays an image that relates to it. I've mashed a couple of examples and almost got it working. There appears to be a problem with the way in which i loop [or don't] through the 'showSprite'/'showHeart' functions.

I'm a little lost with it. Here's the sketch:

#include <Spi.h>
#include <Ethernet.h>
#include <string.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {192, 168, 0, 10 };
byte subnet[] = {255, 255, 255, 0 };

int rowA[] = {9,8,7,6,5,4,3,2};          
int colA[] = {17,16,15,14,13,12,11,10};  

char cmd[15];

int speed = 5; //the delay time in milliseconds
int pauseDelay = 1;    //the number of milliseconds to display each scanned line

Server server(80);

#define bufferMax 128
int bufferSize;
char buffer[bufferMax];

byte data[] = {0,0,0,0,0,0,0,0};  

const int powers[] = {1,2,4,8,16,32,64,128};

void setup()
{
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  
  for(int i = 0; i <8; i++){  //Set the 16 pins used to control the array as OUTPUTs
    pinMode(rowA[i], OUTPUT);
    pinMode(colA[i], OUTPUT);
  }
  
}

void loop()
{
  
    Client client = server.available();
    if (client)
  {
    WaitForRequest(client);
    ParseReceivedRequest(client);
    PerformRequestedCommands(client);
    
    client.stop();
  }
  
}

void WaitForRequest(Client client) // Sets buffer[] and bufferSize
{
  bufferSize = 0;
  
  boolean currentLineIsBlank = true;
  
  while (client.connected()) {
    if (client.available()) {
      char c = client.read();
     
     if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          client.print("i have received the request and i'm <a href='http://www.testingURL.com'>processing</a> it");
          
          break;
        }
     
      if (c == '\n')
        break;
      else
        if (bufferSize < bufferMax)
          buffer[bufferSize++] = c;
        else
          break;
    }
  }
  
 // PrintNumber("bufferSize", bufferSize);
}


void ParseReceivedRequest(Client client)
{
  
  Serial.println("in ParseReceivedRequest");
  Serial.println(buffer);
    
  char* slash1;
  char* slash2;
  
  slash1 = strstr(buffer, "/") + 1; // Look for first slash
  slash2 = strstr(slash1, "/") + 1; // second slash
  
  //PrintString("slash1",slash1);
  //PrintString("slash2",slash2);
  
  cmd[0] = 0;//create array to fill with the main command
  
  strncat(cmd, slash1, slash2-slash1-1);
  
  client.print(" VAR = ");
  client.print(cmd);
  
}

void PerformRequestedCommands(Client client)
{
  
  if ( strcmp(cmd,"heart") == 0 ) showHeart(client);
    
}

void showHeart(Client client){
  
  client.print(" HEART REQUESTED ");
  

    
  data[0] = B01101100; //row 1s bit mask (1 LED is on 0 LED is off)
  data[1] = B11111110; //row 1s bit mask (1 LED is on 0 LED is off)
  data[2] = B11111110; //row 1s bit mask (1 LED is on 0 LED is off)
  data[3] = B11111110; //row 1s bit mask (1 LED is on 0 LED is off)
  data[4] = B01111100; //row 1s bit mask (1 LED is on 0 LED is off)
  data[5] = B00111000; //row 1s bit mask (1 LED is on 0 LED is off)
  data[6] = B00010000; //row 1s bit mask (1 LED is on 0 LED is off)  
  data[7] = B00000000; //row 1s bit mask (1 LED is on 0 LED is off)  
  showSprite(speed);
  
}

void showSprite(int speed2){
for(int iii = 0; iii < speed2; iii++){                 //show the current frame speed2 times
  for(int column = 0; column < 8; column++){            //iterate through each column
   for(int i = 0; i < 8; i++){                          
       digitalWrite(rowA[i], LOW);                      //turn off all row pins  
   }
   for(int i = 0; i < 8; i++){ //Set only the one pin
     if(i == column){     digitalWrite(colA[i], LOW);}  //turns the current row on
     else{                digitalWrite(colA[i], HIGH); }//turns the rest of the rows off
   }

   for(int row = 0; row < 8; row++){                    //iterate through each pixel in the current column
    int bit = (data[column] >> row) & 1;
    if(bit == 1){ 
       digitalWrite(rowA[row], HIGH);                   //if the bit in the data array is set turn the LED on
    }

   }
   delay(pauseDelay);                       //leave the column on for pauseDelay microseconds (too high a delay causes flicker)
  } 
}

}

When this runs and gets a request for a heart the sketch output in the browser as expected however the matrix only briefly shows the first five lines of the heart. It's obviously not looping through the showHeart func right. Can anyone point out where i've gone wrong?

Any help is really appreciated!

The showHeart() function is passed a client object that it doesn't use. Try removing that argument, and calling showHeart from loop(). Does it work any better?

The showSprite() function is called with an argument named speed that appears to influence how many times the heart is displayed. Why is the argument named speed, instead of iterations?

Thanks for the reply. The showHeart() function is called from the PerformRequestedCommands func. I did this so that i could set up a bunch of functions [ showSmile(), showCross() for example] that would make different glif display.

The showHeart function is being passed the client object so it can output to the browsers.

The showSprite() function is called with an argument named speed that appears to influence how many times the heart is displayed. Why is the argument named speed, instead of iterations?

The argument speed shouldn't probably be there. I really just want the glif [in the example a heart] to appear permanently. Any tip on how to eliminate the need for the speed var? I just want to turn on the necessary columns and rows to make the glif display.

Here's the original code i used to display the icon. To explain more all i'm aiming to do it go get this to run via an HTTP request.

int speed = 5; //the delay time in milliseconds

int pauseDelay = 1;    //the number of milliseconds to display each scanned line

//Pin Definitions
int rowA[] = {9,8,7,6,5,4,3,2};          //An Array defining which pin each row is attached to
                                         //(rows are common anode (drive HIGH))
int colA[] = {17,16,15,14,13,12,11,10};  //An Array defining which pin each column is attached to
                                         //(columns are common cathode (drive LOW))

//The array used to hold a bitmap of the display 
//(if you wish to do something other than scrolling marque change the data in this
//variable then display)
byte data[] = {0,0,0,0,0,0,0,0};    


//Setup runs once when power is applied
void setup()
{ 
  Serial.begin(9600);         //Open the Serial port for debugging
  for(int i = 0; i <8; i++){  //Set the 16 pins used to control the array as OUTPUTs
    pinMode(rowA[i], OUTPUT);
    pinMode(colA[i], OUTPUT);
  }
}

//repeats   
void loop()
{
 //Example #1 - test pattern
 //Run a small test program which lights up each light in time
  //test();
  
 //Example #2 - static image
 //Display a defined bitmap

  data[0] = B01101100; //row 1s bit mask (1 LED is on 0 LED is off)
  data[1] = B11111110; //row 1s bit mask (1 LED is on 0 LED is off)
  data[2] = B11111110; //row 1s bit mask (1 LED is on 0 LED is off)
  data[3] = B11111110; //row 1s bit mask (1 LED is on 0 LED is off)
  data[4] = B01111100; //row 1s bit mask (1 LED is on 0 LED is off)
  data[5] = B00111000; //row 1s bit mask (1 LED is on 0 LED is off)
  data[6] = B00010000; //row 1s bit mask (1 LED is on 0 LED is off)  
  data[7] = B00000000; //row 1s bit mask (1 LED is on 0 LED is off)  
  showSprite(speed);

}

//An array to store power values to act as bit masks
const int powers[] = {1,2,4,8,16,32,64,128};



void showSprite(int speed2){
 for(int iii = 0; iii < speed2; iii++){                 //show the current frame speed2 times
  for(int column = 0; column < 8; column++){            //iterate through each column
   for(int i = 0; i < 8; i++){                          
       digitalWrite(rowA[i], LOW);                      //turn off all row pins  
   }
   for(int i = 0; i < 8; i++){ //Set only the one pin
     if(i == column){     digitalWrite(colA[i], LOW);}  //turns the current row on
     else{                digitalWrite(colA[i], HIGH); }//turns the rest of the rows off
   }

   for(int row = 0; row < 8; row++){                    //iterate through each pixel in the current column
    int bit = (data[column] >> row) & 1;
    if(bit == 1){ 
       digitalWrite(rowA[row], HIGH);                   //if the bit in the data array is set turn the LED on
    }

   }
   delay(pauseDelay);                       //leave the column on for pauseDelay microseconds (too high a delay causes flicker)
  } 
 }
}