Home Code 8×8 LED matrix example

8×8 LED matrix example

by shedboy71

This example switches on all the LEDs on a 8×8 LED matrix, the matrix is controlled by a MAX7219

LED matrix

LED matrix

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);
}

Share

You may also like