
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Max72xxPanel.h>

Max72xxPanel myMatrix = Max72xxPanel(9,1,1);
uint8_t  LEDArray[8];

const uint8_t LedArray1[8] PROGMEM ={0x00,0x18,0x24,0x00,0x00,0xa5,0x42,0x00};
const uint8_t LedArray2[8] PROGMEM ={0x00,0x24,0x18,0x00,0x00,0x24,0xc3,0x00};

void setup(){

}

void loop(){
  //MAX7219上显示笑脸和哭脸各1秒

  memcpy_P (&LEDArray, &LedArray1, 8);
  for(int index_i=0; index_i<8; index_i++)
  {
    for(int index_j=1*8; index_j<1*8+8; index_j++)
    {
      if((LEDArray[index_i]&0x01)>0)
       myMatrix.drawPixel(index_j, 7-index_i,1);
  else
  myMatrix.drawPixel(index_j, 7-index_i,0);
       LEDArray[index_i] = LEDArray[index_i]>>1;
    }
  }
  myMatrix.write();
  delay(1000);
  memcpy_P (&LEDArray, &LedArray2, 8);
  for(int index_i=0; index_i<8; index_i++)
  {
    for(int index_j=1*8; index_j<1*8+8; index_j++)
    {
      if((LEDArray[index_i]&0x01)>0)
       myMatrix.drawPixel(index_j, 7-index_i,1);
  else
  myMatrix.drawPixel(index_j, 7-index_i,0);
       LEDArray[index_i] = LEDArray[index_i]>>1;
    }
  }
  myMatrix.write();
  delay(1000);

}
