1.7K
This example switches on all the LEDs on a 8×8 LED matrix, the matrix is controlled by a MAX7219
You will need the Led Control library
#include “LedControl.h”
/*
Max7219_pinCLK = 10;
Max7219_pinCS = 9;
Max7219_pinDIN = 8;
*/
LedControl lc=LedControl(8,10,9,1);
unsigned char i;
unsigned char j;
unsigned long delaytime=100;
void setup()
{
lc.shutdown(0,false);
lc.setIntensity(0,8);
lc.clearDisplay(0);
}
void single() {
for(int row=0;row<8;row++)
{
for(int col=0;col<8;col++)
{
delay(delaytime);
lc.setLed(0,row,col,true);
delay(delaytime);
for(int i=0;i<col;i++)
{
lc.setLed(0,row,col,false);
delay(delaytime);
lc.setLed(0,row,col,true);
delay(delaytime);
}
}
}
}
void loop()
{
single();
lc.clearDisplay(0);
}