Another MAX7219 example using random numbers to randomly light an LED in the matrix, you may want to increase the delay
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
long randNumberX;
long randNumberY;
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
Serial.begin(9600);
// if analog input pin 0 is unconnected, random analog
// noise will cause the call to randomSeed() to generate
randomSeed(analogRead(0));
}
void loop()
{
randNumberX = random(0,8);
randNumberY = random(0,8);
lc.setLed(0,randNumberX,randNumberY,true); // turns on LED at col, row
delay(20);
lc.setLed(0,randNumberX,randNumberY,false); // turns on LED at col, row
delay(20);
}