Need HELP WITH SPI LED MATRIX????

Cool - I want to add some button controlls on the LED Text matrix that I did. I also took on the same Heart Animation thing, kinda used code I created in Flash for something similar and threw it in here. This just moves though animation frames in arrays. The only problem is that you can only hold so much data in the Arduino memory. It wouild die after about 9 or 10 frames. What also works to prevent that is using a temp Array as a buffer and just pass vaules based on a switch statment - so your never really holding all the data at once, just what you want to display....

My Heart Animation Code...

#define CHIPSELECT 10//Chip Select Line
#define SPICLOCK  13//Master Clock
#define DATAOUT 11//DataOut to DataIn on Backpack
#define DATAIN 12//DataIn from DataOut on Backpack

//simple array for data frames - you can use 0-3 for the color settings on the RG display or 0-7 for the RGB Matrixs//
int databuffer[4][8][8] ={
  
 {{0,0,1,1,0,1,1,0},
  {0,1,0,0,1,0,0,1},
  {0,1,0,0,0,0,0,1},
  {0,1,0,0,0,0,0,1},
  {0,0,1,0,0,0,1,0},
  {0,0,0,1,0,1,0,0},
  {0,0,0,0,1,0,0,0},
  {0,0,0,0,0,0,0,0}},
  
 {{0,0,0,0,0,0,0,0},
  {0,0,0,1,0,1,0,0},
  {0,0,1,0,1,0,1,0},
  {0,0,1,0,0,0,1,0},
  {0,0,0,1,0,1,0,0},
  {0,0,0,0,1,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,0,0},
  {0,0,0,0,0,0,0,0},
  {0,0,0,1,0,1,0,0},
  {0,0,0,1,1,1,0,0},
  {0,0,0,0,1,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,0,0}},

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

  } ;

int z=0;

// SPI data load / transfer function - thanks Heather Dewey-Hagborg //
char spi_transfer(volatile char data) 
{ 
  SPDR = data;                    // Start the transmission 
  while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission 
  { 
  }; 
} 

void clearDisplay() {
   for (int i=0;i<8;i++) for (int j=0;j<8;j++) 
    { spi_transfer( 0 ); } 
    delay(50);   
}

void setup() 
{ 
  byte clr; 
  pinMode(DATAOUT,OUTPUT); 
  pinMode(SPICLOCK,OUTPUT); 
  pinMode(CHIPSELECT,OUTPUT); 
  digitalWrite(CHIPSELECT,HIGH); //disable device 

  SPCR = B01010001;             //SPI Registers 
  SPSR = SPSR & B11111110;      //make sure the speed is 125KHz 

  clr=SPSR; 
  clr=SPDR; 
  delay(10); 
  clearDisplay();
} 

void loop()            
{ 
    int z=0;
    //loop though frames #4 //
    for (int z=0;z<4;z++) {
    delay(100);                    
    digitalWrite(CHIPSELECT,LOW); // enable the ChipSelect
    delayMicroseconds(500); 

       for (int i=0;i<8;i++) {
       for (int j=0;j<8;j++) { 
       spi_transfer( databuffer[z][i][j] );         
       } 
       }

    digitalWrite(CHIPSELECT,HIGH); // disable the ChipSelect
    delayMicroseconds(500); 
    
    }
       
    delay(100); 
}

I'll try to clean up the Text Matrix code I have too - that is set to use two LED Matrix's so its easy to modify for more or less...

Here is the youtube link tot he dual matrix scroller!

:slight_smile: