Arduino 8X8 LED Matrix

In this session I take 2 8X8 LED matrix boards and join them to the Arduino.

Parts Needed

Here is the code that I have to make the displays blink from one set of values to another

You need to include this in your Arduino software before running your code. Click Sketch — Import Library — add Library. Then select the zip file you downloaded. That is it after that just take the code and start having fun. Look below the code for a tool to help build displays.

#include "LedControl.h"
 
LedControl lc=LedControl(12,11,10,2);  // Pins: DIN,CLK,CS, # of Display connected
 
unsigned long delayTime=200;  // Delay between Frames
 
// Put values in arrays
byte invader1a[] =
{
   B00011110,  // 0 = off 1 = on this is row 1 and 8 across
   B00010010,
   B00010010,
   B00110010,
   B01000010,
   B00111110,
   B10101010,
   B01111111
};
 
byte invader1b[] =
{
   B00010010,
   B00010010,
   B00110010,
   B01000010,
   B00111110,
   B10101010,
   B01111111,
   B00000000
};
 
byte invader2a[] =
{
   B00011110,  
   B00010010,
   B00010010,
   B00110010,
   B01000010,
   B00111110,
   B10101010,
   B01111111
};
 
byte invader2b[] =
{
   B00010010,
   B00010010,
   B00110010,
   B01000010,
   B00111110,
   B10101010,
   B01111111,
   B00000000
};
 
void setup()
{
  lc.shutdown(0,false);  // Wake up displays
  lc.shutdown(1,false);
  lc.setIntensity(0,5);  // Set intensity levels
  lc.setIntensity(1,5);
  lc.clearDisplay(0);  // Clear Displays
  lc.clearDisplay(1);
}
 
 
//  Take values in Arrays and Display them
void sinvader1a()
{
  for (int i = 0; i < 8; i++)  
  {
    lc.setRow(0,i,invader1a[i]);
  }
}
 
void sinvader1b()
{
  for (int i = 0; i < 8; i++)
  {
    lc.setRow(0,i,invader1b[i]);
  }
}
 
void sinvader2a()
{
  for (int i = 0; i < 8; i++)
  {
    lc.setRow(1,i,invader2a[i]);
  }
}
 
void sinvader2b()
{
  for (int i = 0; i < 8; i++)
  {
    lc.setRow(1,i,invader2b[i]);
  }
}
 
void loop()
{
// Put #1 frame on both Display
    sinvader1a();
    sinvader2a();
    delay(delayTime);
 
 
// Put #2 frame on both Display
    sinvader1b();
    sinvader2b();
    delay(delayTime);
 
}

This is a fun tool for writing the 0101 code needed. All you need to do is click each check box you want to turn on. Checked is on and unChecked is off. Make you first pattern on the left and your second pattern on the right. Click the view code button and it will generate the code blocks to replace in the main code above. There is a clear button for the left and right. This just unchecks the boxes.

Leave a Reply

Your email address will not be published. Required fields are marked *