Simple MAX7219 example

The first thing you will need that makes things easier is to  download and install the LedControl Arduino library as it is essential for using the MAX7219.

 

Code

#include “LedControl.h” //  need the library
LedControl lc=LedControl(12,11,10,1); //

// pin 12 is connected to the MAX7219 pin 1 labelled DIN
// pin 11 is connected to the CLK pin 13 labelled CLK
// pin 10 is connected to LOAD pin 12 labelled as CS
// 1 as we only have 1 MAX 7219 atatched

void setup()
{
// the zero refers to the MAX7219 number
lc.shutdown(0,false);// turn off power saving
lc.setIntensity(0,4);// sets brightness (0~15 possible values)
lc.clearDisplay(0);// clear screen
}

void loop()
{
for (int row=0; row<8; row++)
{
for (int col=0; col<8; col++)
{
lc.setLed(0,col,row,true); // turns on LED at col, row
delay(25);
}
}

for (int row=0; row<8; row++)
{
for (int col=0; col<8; col++)
{
lc.setLed(0,col,row,false); // turns off LED at col, row
delay(25);
}
}
}