this one compiles and runs on my arduino uno
#include "LedControl.h"
LedControl lc=LedControl(12,11,10,4); //pin 12 DATA IN, pin 11 CLK, pin 10 LOAD, 1 max7219 IC
int dela=100; //delay a
int delb=1000; //delay b
int delc=300; //delay c
int deld=50; //delay d
int x=1;
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0,2); /* Set the brightness 0-15 /
lc.clearDisplay(0); / and clear the display */
}
void Smiley() {
/* DISPLAY OUTPUT DATA */
byte smiley[8]={B00000000,B01100110,B01100110,B00000000,B00000000,B01100110,B00111100,B00000000};
byte antismiley[8]={B11111111,B10011001,B10011001,B11111111,B11111111,B10011001,B11000011,B11111111};
for ( x=1; x<=10; x++)
{
lc.setRow(0,0,smiley[0]);
lc.setRow(0,1,smiley[1]);
lc.setRow(0,2,smiley[2]);
lc.setRow(0,3,smiley[3]);
lc.setRow(0,4,smiley[4]);
lc.setRow(0,5,smiley[5]);
lc.setRow(0,6,smiley[6]);
lc.setRow(0,7,smiley[7]);
delay(dela);
lc.setRow(0,0,antismiley[0]);
lc.setRow(0,1,antismiley[1]);
lc.setRow(0,2,antismiley[2]);
lc.setRow(0,3,antismiley[3]);
lc.setRow(0,4,antismiley[4]);
lc.setRow(0,5,antismiley[5]);
lc.setRow(0,6,antismiley[6]);
lc.setRow(0,7,antismiley[7]);
delay(dela);
}
lc.setRow(0,0,0);
lc.setRow(0,1,0);
lc.setRow(0,2,0);
lc.setRow(0,3,0);
lc.setRow(0,4,0);
lc.setRow(0,5,0);
lc.setRow(0,6,0);
lc.setRow(0,7,0);
delay(delb);
}
void Matrix() {
/* DISPLAY OUTPUT DATA */
byte on[8]={B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111};
byte N[8]={B00000000,B10001100,B11000100,B11100100,B10110100,B10011100,B10001100,B11000100};
byte three[8]={B00000000,B00011000,B00100100,B00000100,B00011000,B00000100,B00100100,B00011000};
byte K[8]={B00000000,B11001100,B01001000,B01010000,B01100000,B01010000,B01001000,B11001100};
byte C[8]={B00000000,B00111100,B01100100,B01000000,B01000000,B01000000,B01100100,B00111100};
byte A[8]={B00000000,B00010000,B00111000,B01101100,B01000100,B01111100,B01000100,B01000100};
lc.setRow(0,0,N[0]);
lc.setRow(0,1,N[1]);
lc.setRow(0,2,N[2]);
lc.setRow(0,3,N[3]);
lc.setRow(0,4,N[4]);
lc.setRow(0,5,N[5]);
lc.setRow(0,6,N[6]);
lc.setRow(0,7,N[7]);
delay(delc);
lc.setRow(0,0,three[0]);
lc.setRow(0,1,three[1]);
lc.setRow(0,2,three[2]);
lc.setRow(0,3,three[3]);
lc.setRow(0,4,three[4]);
lc.setRow(0,5,three[5]);
lc.setRow(0,6,three[6]);
lc.setRow(0,7,three[7]);
delay(delc);
lc.setRow(0,0,K[0]);
lc.setRow(0,1,K[1]);
lc.setRow(0,2,K[2]);
lc.setRow(0,3,K[3]);
lc.setRow(0,4,K[4]);
lc.setRow(0,5,K[5]);
lc.setRow(0,6,K[6]);
lc.setRow(0,7,K[7]);
delay(delc);
lc.setRow(0,0,C[0]);
lc.setRow(0,1,C[1]);
lc.setRow(0,2,C[2]);
lc.setRow(0,3,C[3]);
lc.setRow(0,4,C[4]);
lc.setRow(0,5,C[5]);
lc.setRow(0,6,C[6]);
lc.setRow(0,7,C[7]);
delay(delc);
lc.setRow(0,0,A[0]);
lc.setRow(0,1,A[1]);
lc.setRow(0,2,A[2]);
lc.setRow(0,3,A[3]);
lc.setRow(0,4,A[4]);
lc.setRow(0,5,A[5]);
lc.setRow(0,6,A[6]);
lc.setRow(0,7,A[7]);
delay(delc);
lc.setRow(0,0,0);
lc.setRow(0,1,0);
lc.setRow(0,2,0);
lc.setRow(0,3,0);
lc.setRow(0,4,0);
lc.setRow(0,5,0);
lc.setRow(0,6,0);
lc.setRow(0,7,0);
delay(delb);
}
void Animation(){
for ( x=1; x<=6; x++)
{
lc.setColumn(0,0,B00010010); //alien
lc.setColumn(0,1,B00110100);
lc.setColumn(0,2,B01101010);
lc.setColumn(0,3,B01110100);
lc.setColumn(0,4,B01110100);
lc.setColumn(0,5,B01101010);
lc.setColumn(0,6,B00110100);
lc.setColumn(0,7,B00010010);
delay(200);
lc.setColumn(0,0,B00010000); //alien
lc.setColumn(0,1,B00110110);
lc.setColumn(0,2,B01011000);
lc.setColumn(0,3,B01110100);
lc.setColumn(0,4,B01110100);
lc.setColumn(0,5,B01011000);
lc.setColumn(0,6,B00110110);
lc.setColumn(0,7,B00010000);
delay(200);
for(int col=3;col<5;col++) {
lc.setLed(0,0,col,true);
delay(50);
for(int i=0;i<col;i++) {
lc.setLed(0,0,col,false);
}
}
}
}
void loop() {
Smiley();
Matrix();
Animation();
Matrix();
}