* These pin numbers will probably not work with your hardware *

* These pin numbers will probably not work with your hardware *
pin 12 is connected to the DataIn
pin 11 is connected to LOAD(CS)
pin 10 is connected to the CLK
We have only a single MAX72XX.
*/
LedControl lc=LedControl(12,10,11,1);
/* image switching time */
unsigned long delaytime1=500;
unsigned long delaytime2=50;
void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
}
/*
This method will display the characters for the
word "Arduino" one after the other on the matrix.
(you need at least 5x7 leds to see the whole chars)
*/
void writeArduinoOnMatrix() {
/* here is the data for the characters */
byte ALL[] = {B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111};
byte EX[] = {B00000000,B00010000,B00010000,B00010000,B00010000,B00000000,B00010000,B00000000};
byte A[] = {B00000000,B00111100,B00100100,B00100100,B00111100,B00100100,B00100100,B00000000};
byte B[] = {B01111000,B01001000,B01001000,B01110000,B01001000,B01000100,B01000100,B01111100};
byte C[] = {B00000000,B00011110,B00100000,B01000000,B01000000,B01000000,B00100000,B00011110};
byte D[] = {B00000000,B00111000,B00100100,B00100010,B00100010,B00100100,B00111000,B00000000};
byte E[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00111100,B00000000};
byte F[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00100000,B00000000};
byte G[] = {B00000000,B00111110,B00100000,B00100000,B00101110,B00100010,B00111110,B00000000};
byte H[] = {B00000000,B00100100,B00100100,B00111100,B00100100,B00100100,B00100100,B00000000};
byte I[] = {B00000000,B00111000,B00010000,B00010000,B00010000,B00010000,B00111000,B00000000};
byte J[] = {B00000000,B00011100,B00001000,B00001000,B00001000,B00101000,B00111000,B00000000};
byte K[] = {B00000000,B00100100,B00101000,B00110000,B00101000,B00100100,B00100100,B00000000};
byte L[] = {B00000000,B00100000,B00100000,B00100000,B00100000,B00100000,B00111100,B00000000};
byte M[] = {B00000000,B00000000,B01000100,B01101100,B01010100,B01000100,B01000100,B00000000};
byte N[] = {B00000000,B00100010,B00110010,B00101010,B00100110,B00100010,B00000000,B00000000};
byte O[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000010,B00111100,B00000000};
byte P[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100000,B00100000,B00000000};
byte Q[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000110,B00111110,B00000001};
byte R[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100100,B00100100,B00000000};
byte S[] = {B00000000,B00111100,B00100000,B00111100,B00000100,B00000100,B00111100,B00000000};
byte T[] = {B00000000,B01111100,B00010000,B00010000,B00010000,B00010000,B00010000,B00000000};
byte U[] = {B00000000,B01000010,B01000010,B01000010,B01000010,B00100100,B00011000,B00000000};
byte V[] = {B00000000,B00100010,B00100010,B00100010,B00010100,B00010100,B00001000,B00000000};
byte W[] = {B00000000,B10000010,B10010010,B01010100,B01010100,B00101000,B00000000,B00000000};
byte X[] = {B00000000,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B00000000};
byte Y[] = {B00000000,B01000100,B00101000,B00010000,B00010000,B00010000,B00010000,B00000000};
byte Z[] = {B00000000,B00111100,B00000100,B00001000,B00010000,B00100000,B00111100,B00000000};
/* now display them one by one with a small delay */
lc.setRow(0,0,H[0]);
lc.setRow(0,1,H[1]);
lc.setRow(0,2,H[2]);
lc.setRow(0,3,H[3]);
lc.setRow(0,4,H[4]);
lc.setRow(0,5,H[5]);
lc.setRow(0,6,H[6]);
lc.setRow(0,7,H[7]);
delay(delaytime1);
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(delaytime1);
lc.setRow(0,0,M[0]);
lc.setRow(0,1,M[1]);
lc.setRow(0,2,M[2]);
lc.setRow(0,3,M[3]);
lc.setRow(0,4,M[4]);
lc.setRow(0,5,M[5]);
lc.setRow(0,6,M[6]);
lc.setRow(0,7,M[7]);
delay(delaytime1);
lc.setRow(0,0,E[0]);
lc.setRow(0,1,E[1]);
lc.setRow(0,2,E[2]);
lc.setRow(0,3,E[3]);
lc.setRow(0,4,E[4]);
lc.setRow(0,5,E[5]);
lc.setRow(0,6,E[6]);
lc.setRow(0,7,E[7]);
delay(delaytime1);
lc.setRow(0,0,D[0]);
lc.setRow(0,1,D[1]);
lc.setRow(0,2,D[2]);
lc.setRow(0,3,D[3]);
lc.setRow(0,4,D[4]);
lc.setRow(0,5,D[5]);
lc.setRow(0,6,D[6]);
lc.setRow(0,7,D[7]);
delay(delaytime1);
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(delaytime1);
}
void loop() {
writeArduinoOnMatrix();
}
http://fayllar.org
|