Using 8×8 Dot Matrix LED with Arduino & Cascade Connection © GPL3+

You’ll learn how to use an 8×8 dot matrix LED module with IC MAX7219. You will also learn its cascade connection & how to display shapes.

  • 987 views
  • 0 comments
  • 2 respects

Components and supplies

Apps and online services

About this project

You can read this and other amazing tutorials on ElectroPeak's official website

Overview

In this tutorial, you’ll learn how to use a 8×8 dot matrix LED module with IC MAX7219. At the end, you’ll be able to display any shape or text on one or more Dot matrix easily, fixed or scrolled, using only 4 digital pins of arduino.

What You Will Learn:

  • What dot matrix LED is
  • How to use Dot matrix LEDs with Arduino
  • Displaying specific shapes on a Dot matrix LED module
  • Cascading two Dot matrix LEDs

What Is Dot Matrix?

ot Matrix LED 8×8 is an array of LEDs that you can display particular numbers, letters, and shapes on it. Dot matrixes are indicated by the number of rows and columns. The most popular type of Dot Matrix is ​​its 8×8 type, which provides 64 LEDs in 8 rows and 8 columns.

To control the Dot Matrix 8×8 simply, you should connect each row and each column to a digital pin, which means you need 16 digital pins! So it’s not a proper way.

To control Dot Matrix, there are modules based on MAX72xx ICS which need to connect to 4 digital pins instead of 16. You can also connect multiple Dot Matrix (up to 8) to each other without needing any extra pin and cascades them.

How to Interface Dot Matrix Module w/ Arduino

Circuit

To connect the Dot Matrix to Arduino, simply connect the Vcc and GND pins to 5V and GND Arduino, and the DIN, CS, and CLK pins of dot matrix can be connected to any digital pins of arduino.

Code

There are various libraries for Dot matrix and Arduino. The Ledcontrol and MaxMatrixlibraries are two of the most common libraries, both have the same structure.

Now upload the following code on your Arduino board.

/*
 8x8 Dot Matrix w/ MAX7219
 modified on 7 March 2019
 by Saeed Hosseini @ Electropeak
 https://electropeak.com/learn/
*/
#include <MaxMatrix.h>
int DIN = 7;
int CLK = 6;
int CS = 5;
int maxInUse = 1;
byte buffer[20];
char text[] = "a";
MaxMatrix m(DIN, CS, CLK, maxInUse);
void setup() {
 m.init();
 m.setIntensity(8);
}
void loop() {
 m.setDot(0, 7, true);
 m.setDot(0, 7, true);
 delay(1000);
 m.setDot(7, 0, true);
 delay(1000);
 m.setColumn(3, B11110000);
 delay(1000);
 m.setColumn(4, B00001111);
 delay(1000);
 m.clear();
 delay(1000);
} 

Some of the most important functions of this library are as follows:

Displaying specific shapes on Dot Matrix

To display your particular shapes on the Dot Matrix, just turn the LED light pattern into a bit string. To do this, you can get help from online tools like this. Design your shape and copy the generated code to Arduino, then upload it on your board.

/*
 8x8 Dot Matrix w/ MAX7219
 modified on 7 March 2019
 by Saeed Hosseini @ Electropeak
 https://electropeak.com/learn/
*/
#include <MaxMatrix.h>
int DIN = 7;
int CLK = 6;
int CS = 5;
int maxInUse = 1;
MaxMatrix m(DIN, CS, CLK, maxInUse);
byte poker[] = {8, 8,
               0xff,
               0x81,
               0xa5,
               0xa1,
               0xa1,
               0xa5,
               0x81,
               0xff
              };
byte smile[] = {8, 8,
               0xff,
               0x81,
               0xb5,
               0xa1,
               0xa1,
               0xb5,
               0x81,
               0xff
              };
byte sad[] = {8, 8,
             0xff,
             0x81,
             0xb5,
             0x91,
             0x91,
             0xb5,
             0x81,
             0xff
            };
byte kiss[] = {8, 8,
              0xff,
              0x81,
              0xb5,
              0xb1,
              0xb1,
              0xb5,
              0x81,
              0xff
             };
void setup() {
 m.init();
 m.setIntensity(8);
}
void loop() {
 m.writeSprite(0, 0, smile);
 delay(1000);
 m.clear();
 m.writeSprite(0, 0, poker);
 delay(1000);
 m.clear();
 m.writeSprite(0, 0, sad);
 delay(1000);
 m.clear();
 m.writeSprite(0, 0, kiss);
 delay(1000);
 for (int i = 0; i < 8; i++) {
   m.shiftLeft(false, false);
   delay(300);
 }
 m.clear();
} 

You can also create and display numbers and letters by this method.

To insert common numbers, letters, and symbols, you can use the following strings and functions:

#include <avr/pgmspace.h>
byte buffer[10];
PROGMEM const unsigned char CH[] = {
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
1, 8, B01011111, B00000000, B00000000, B00000000, B00000000, // !
3, 8, B00000011, B00000000, B00000011, B00000000, B00000000, // "
5, 8, B00010100, B00111110, B00010100, B00111110, B00010100, // #
4, 8, B00100100, B01101010, B00101011, B00010010, B00000000, // $
5, 8, B01100011, B00010011, B00001000, B01100100, B01100011, // %
5, 8, B00110110, B01001001, B01010110, B00100000, B01010000, // &
1, 8, B00000011, B00000000, B00000000, B00000000, B00000000, // '
3, 8, B00011100, B00100010, B01000001, B00000000, B00000000, // (
3, 8, B01000001, B00100010, B00011100, B00000000, B00000000, // )
5, 8, B00101000, B00011000, B00001110, B00011000, B00101000, // *
5, 8, B00001000, B00001000, B00111110, B00001000, B00001000, // +
2, 8, B10110000, B01110000, B00000000, B00000000, B00000000, // ,
4, 8, B00001000, B00001000, B00001000, B00001000, B00000000, // -
2, 8, B01100000, B01100000, B00000000, B00000000, B00000000, // .
4, 8, B01100000, B00011000, B00000110, B00000001, B00000000, // /
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // 0
3, 8, B01000010, B01111111, B01000000, B00000000, B00000000, // 1
4, 8, B01100010, B01010001, B01001001, B01000110, B00000000, // 2
4, 8, B00100010, B01000001, B01001001, B00110110, B00000000, // 3
4, 8, B00011000, B00010100, B00010010, B01111111, B00000000, // 4
4, 8, B00100111, B01000101, B01000101, B00111001, B00000000, // 5
4, 8, B00111110, B01001001, B01001001, B00110000, B00000000, // 6
4, 8, B01100001, B00010001, B00001001, B00000111, B00000000, // 7
4, 8, B00110110, B01001001, B01001001, B00110110, B00000000, // 8
4, 8, B00000110, B01001001, B01001001, B00111110, B00000000, // 9
2, 8, B01010000, B00000000, B00000000, B00000000, B00000000, // :
2, 8, B10000000, B01010000, B00000000, B00000000, B00000000, // ;
3, 8, B00010000, B00101000, B01000100, B00000000, B00000000, // < 3, 8, B00010100, B00010100, B00010100, B00000000, B00000000, // = 3, 8, B01000100, B00101000, B00010000, B00000000, B00000000, // >
4, 8, B00000010, B01011001, B00001001, B00000110, B00000000, // ?
5, 8, B00111110, B01001001, B01010101, B01011101, B00001110, // @
4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A
4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B
4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C
4, 8, B01111111, B01000001, B01000001, B00111110, B00000000, // D
4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E
4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F
4, 8, B00111110, B01000001, B01001001, B01111010, B00000000, // G
4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H
3, 8, B01000001, B01111111, B01000001, B00000000, B00000000, // I
4, 8, B00110000, B01000000, B01000001, B00111111, B00000000, // J
4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // K
4, 8, B01111111, B01000000, B01000000, B01000000, B00000000, // L
5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M
5, 8, B01111111, B00000100, B00001000, B00010000, B01111111, // N
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O
4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P
4, 8, B00111110, B01000001, B01000001, B10111110, B00000000, // Q
4, 8, B01111111, B00001001, B00001001, B01110110, B00000000, // R
4, 8, B01000110, B01001001, B01001001, B00110010, B00000000, // S
5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T
4, 8, B00111111, B01000000, B01000000, B00111111, B00000000, // U
5, 8, B00001111, B00110000, B01000000, B00110000, B00001111, // V
5, 8, B00111111, B01000000, B00111000, B01000000, B00111111, // W
5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X
5, 8, B00000111, B00001000, B01110000, B00001000, B00000111, // Y
4, 8, B01100001, B01010001, B01001001, B01000111, B00000000, // Z
2, 8, B01111111, B01000001, B00000000, B00000000, B00000000, // [
4, 8, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash
2, 8, B01000001, B01111111, B00000000, B00000000, B00000000, // ]
3, 8, B00000010, B00000001, B00000010, B00000000, B00000000, // hat
4, 8, B01000000, B01000000, B01000000, B01000000, B00000000, // _
2, 8, B00000001, B00000010, B00000000, B00000000, B00000000, // `
4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a
4, 8, B01111111, B01000100, B01000100, B00111000, B00000000, // b
4, 8, B00111000, B01000100, B01000100, B00101000, B00000000, // c
4, 8, B00111000, B01000100, B01000100, B01111111, B00000000, // d
4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e
3, 8, B00000100, B01111110, B00000101, B00000000, B00000000, // f
4, 8, B10011000, B10100100, B10100100, B01111000, B00000000, // g
4, 8, B01111111, B00000100, B00000100, B01111000, B00000000, // h
3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i
4, 8, B01000000, B10000000, B10000100, B01111101, B00000000, // j
4, 8, B01111111, B00010000, B00101000, B01000100, B00000000, // k
3, 8, B01000001, B01111111, B01000000, B00000000, B00000000, // l
5, 8, B01111100, B00000100, B01111100, B00000100, B01111000, // m
4, 8, B01111100, B00000100, B00000100, B01111000, B00000000, // n
4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // o
4, 8, B11111100, B00100100, B00100100, B00011000, B00000000, // p
4, 8, B00011000, B00100100, B00100100, B11111100, B00000000, // q
4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r
4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s
3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t
4, 8, B00111100, B01000000, B01000000, B01111100, B00000000, // u
5, 8, B00011100, B00100000, B01000000, B00100000, B00011100, // v
5, 8, B00111100, B01000000, B00111100, B01000000, B00111100, // w
5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x
4, 8, B10011100, B10100000, B10100000, B01111100, B00000000, // y
3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z
3, 8, B00001000, B00110110, B01000001, B00000000, B00000000, // {
1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // |
3, 8, B01000001, B00110110, B00001000, B00000000, B00000000, // }
4, 8, B00001000, B00000100, B00001000, B00000100, B00000000, // ~
 };
void printCharWithShift(char c, int shift_speed) {
if (c < 32) return;
c -= 32;
memcpy_P(buffer, CH + 7 * c, 7);
m.writeSprite(32, 0, buffer);
m.setColumn(32 + buffer[0], 0);
•  for (int i = 0; i < buffer[0] + 1; i++)
{
delay(shift_speed);
m.shiftLeft(false, false);
}
}
void printStringWithShift(char* s, int shift_speed) {
while (*s != 0) {
printCharWithShift(*s, shift_speed);
s++;
}
}
void printString(char* s)
{
int col = 0;
while (*s != 0)
{
if (*s < 32) continue;
char c = *s - 32;
memcpy_P(buffer, CH + 7 * c, 7);
m.writeSprite(col, 0, buffer);
m.setColumn(col + buffer[0], 0);
col += buffer[0] + 1;
s++;
}
}

Cascading Two Dot Matrix LED Modules

One of the interesting features of the Dot Matrix module are ability to connect multiple (up to 8) modules and display cascading information on them.

Circuit

To do this connect Dout from the first module to Din of the next module and connect other pins with the same name to each others.

Code

Now upload the following code on your Arduino and see the result.

/*
 8x8 Dot Matrix w/ MAX7219
 modified on 7 March 2019
 by Saeed Hosseini @ Electropeak
 https://electropeak.com/learn/
*/
#include <MaxMatrix.h>
int DIN = 7;
int CLK = 6;
int CS = 5;
int maxInUse = 2;
MaxMatrix m(DIN, CS, CLK, maxInUse);
byte pakman[] = {8, 8, 0x1c, 0x22, 0x41, 0x49, 0x55, 0x22, 0x00, 0x08};
void setup() {
 m.init();
 m.setIntensity(2);
}
void loop(){
 m.writeSprite(0, 0, pakman);
 delay(300);
 for (int i = 0; i < 8; i++) {
   m.shiftRight(false, true);
   delay(300);
 }
 m.clear();
} 

Note

Do not forget that you are only programming the first module directly.

Code

CodeArduino
/*
  8x8 Dot Matrix w/ MAX7219
  modified on 7 March 2019
  by Saeed Hosseini @ Electropeak
  https://electropeak.com/learn/
*/
#include <MaxMatrix.h>


int DIN = 7;
int CLK = 6;
int CS = 5;
int maxInUse = 1;

byte buffer[20];
char text[] = "a";

MaxMatrix m(DIN, CS, CLK, maxInUse);

void setup() {
  m.init();
  m.setIntensity(8);
}
void loop() {
  m.setDot(0, 7, true);

  m.setDot(0, 7, true);
  delay(1000);
  m.setDot(7, 0, true);
  delay(1000);
  m.setColumn(3, B11110000);
  delay(1000);
  m.setColumn(4, B00001111);
  delay(1000);
  m.clear();
  delay(1000);
}
code 2Arduino
Displaying specific shapes on Dot Matrix
/*
  8x8 Dot Matrix w/ MAX7219
  modified on 7 March 2019
  by Saeed Hosseini @ Electropeak
  https://electropeak.com/learn/
*/
#include <MaxMatrix.h>

int DIN = 7;
int CLK = 6;
int CS = 5;
int maxInUse = 1;

MaxMatrix m(DIN, CS, CLK, maxInUse);

byte poker[] = {8, 8,
                0xff,
                0x81,
                0xa5,
                0xa1,
                0xa1,
                0xa5,
                0x81,
                0xff
               };
byte smile[] = {8, 8,
                0xff,
                0x81,
                0xb5,
                0xa1,
                0xa1,
                0xb5,
                0x81,
                0xff
               };
byte sad[] = {8, 8,
              0xff,
              0x81,
              0xb5,
              0x91,
              0x91,
              0xb5,
              0x81,
              0xff
             };
byte kiss[] = {8, 8,
               0xff,
               0x81,
               0xb5,
               0xb1,
               0xb1,
               0xb5,
               0x81,
               0xff
              };
void setup() {
  m.init();
  m.setIntensity(8);
}
void loop() {
  m.writeSprite(0, 0, smile);
  delay(1000);
  m.clear();
  m.writeSprite(0, 0, poker);
  delay(1000);
  m.clear();
  m.writeSprite(0, 0, sad);
  delay(1000);
  m.clear();
  m.writeSprite(0, 0, kiss);
  delay(1000);
  for (int i = 0; i < 8; i++) {
    m.shiftLeft(false, false);
    delay(300);
  }
  m.clear();
}
Code 3Arduino
Displaying specific shapes on Dot Matrix
#include <avr/pgmspace.h>
byte buffer[10];
 PROGMEM const unsigned char CH[] = {
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
1, 8, B01011111, B00000000, B00000000, B00000000, B00000000, // !
3, 8, B00000011, B00000000, B00000011, B00000000, B00000000, // "
5, 8, B00010100, B00111110, B00010100, B00111110, B00010100, // #
4, 8, B00100100, B01101010, B00101011, B00010010, B00000000, // $
5, 8, B01100011, B00010011, B00001000, B01100100, B01100011, // %
5, 8, B00110110, B01001001, B01010110, B00100000, B01010000, // &
1, 8, B00000011, B00000000, B00000000, B00000000, B00000000, // '
3, 8, B00011100, B00100010, B01000001, B00000000, B00000000, // (
3, 8, B01000001, B00100010, B00011100, B00000000, B00000000, // )
5, 8, B00101000, B00011000, B00001110, B00011000, B00101000, // *
5, 8, B00001000, B00001000, B00111110, B00001000, B00001000, // +
2, 8, B10110000, B01110000, B00000000, B00000000, B00000000, // ,
4, 8, B00001000, B00001000, B00001000, B00001000, B00000000, // -
2, 8, B01100000, B01100000, B00000000, B00000000, B00000000, // .
4, 8, B01100000, B00011000, B00000110, B00000001, B00000000, // /
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // 0
3, 8, B01000010, B01111111, B01000000, B00000000, B00000000, // 1
4, 8, B01100010, B01010001, B01001001, B01000110, B00000000, // 2
4, 8, B00100010, B01000001, B01001001, B00110110, B00000000, // 3
4, 8, B00011000, B00010100, B00010010, B01111111, B00000000, // 4
4, 8, B00100111, B01000101, B01000101, B00111001, B00000000, // 5
4, 8, B00111110, B01001001, B01001001, B00110000, B00000000, // 6
4, 8, B01100001, B00010001, B00001001, B00000111, B00000000, // 7
4, 8, B00110110, B01001001, B01001001, B00110110, B00000000, // 8
4, 8, B00000110, B01001001, B01001001, B00111110, B00000000, // 9
2, 8, B01010000, B00000000, B00000000, B00000000, B00000000, // :
2, 8, B10000000, B01010000, B00000000, B00000000, B00000000, // ;
3, 8, B00010000, B00101000, B01000100, B00000000, B00000000, // < 3, 8, B00010100, B00010100, B00010100, B00000000, B00000000, // = 3, 8, B01000100, B00101000, B00010000, B00000000, B00000000, // >
4, 8, B00000010, B01011001, B00001001, B00000110, B00000000, // ?
5, 8, B00111110, B01001001, B01010101, B01011101, B00001110, // @
4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A
4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B
4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C
4, 8, B01111111, B01000001, B01000001, B00111110, B00000000, // D
4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E
4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F
4, 8, B00111110, B01000001, B01001001, B01111010, B00000000, // G
4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H
3, 8, B01000001, B01111111, B01000001, B00000000, B00000000, // I
4, 8, B00110000, B01000000, B01000001, B00111111, B00000000, // J
4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // K
4, 8, B01111111, B01000000, B01000000, B01000000, B00000000, // L
5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M
5, 8, B01111111, B00000100, B00001000, B00010000, B01111111, // N
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O
4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P
4, 8, B00111110, B01000001, B01000001, B10111110, B00000000, // Q
4, 8, B01111111, B00001001, B00001001, B01110110, B00000000, // R
4, 8, B01000110, B01001001, B01001001, B00110010, B00000000, // S
5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T
4, 8, B00111111, B01000000, B01000000, B00111111, B00000000, // U
5, 8, B00001111, B00110000, B01000000, B00110000, B00001111, // V
5, 8, B00111111, B01000000, B00111000, B01000000, B00111111, // W
5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X
5, 8, B00000111, B00001000, B01110000, B00001000, B00000111, // Y
4, 8, B01100001, B01010001, B01001001, B01000111, B00000000, // Z
2, 8, B01111111, B01000001, B00000000, B00000000, B00000000, // [
4, 8, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash
2, 8, B01000001, B01111111, B00000000, B00000000, B00000000, // ]
3, 8, B00000010, B00000001, B00000010, B00000000, B00000000, // hat
4, 8, B01000000, B01000000, B01000000, B01000000, B00000000, // _
2, 8, B00000001, B00000010, B00000000, B00000000, B00000000, // `
4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a
4, 8, B01111111, B01000100, B01000100, B00111000, B00000000, // b
4, 8, B00111000, B01000100, B01000100, B00101000, B00000000, // c
4, 8, B00111000, B01000100, B01000100, B01111111, B00000000, // d
4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e
3, 8, B00000100, B01111110, B00000101, B00000000, B00000000, // f
4, 8, B10011000, B10100100, B10100100, B01111000, B00000000, // g
4, 8, B01111111, B00000100, B00000100, B01111000, B00000000, // h
3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i
4, 8, B01000000, B10000000, B10000100, B01111101, B00000000, // j
4, 8, B01111111, B00010000, B00101000, B01000100, B00000000, // k
3, 8, B01000001, B01111111, B01000000, B00000000, B00000000, // l
5, 8, B01111100, B00000100, B01111100, B00000100, B01111000, // m
4, 8, B01111100, B00000100, B00000100, B01111000, B00000000, // n
4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // o
4, 8, B11111100, B00100100, B00100100, B00011000, B00000000, // p
4, 8, B00011000, B00100100, B00100100, B11111100, B00000000, // q
4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r
4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s
3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t
4, 8, B00111100, B01000000, B01000000, B01111100, B00000000, // u
5, 8, B00011100, B00100000, B01000000, B00100000, B00011100, // v
5, 8, B00111100, B01000000, B00111100, B01000000, B00111100, // w
5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x
4, 8, B10011100, B10100000, B10100000, B01111100, B00000000, // y
3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z
3, 8, B00001000, B00110110, B01000001, B00000000, B00000000, // {
1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // |
3, 8, B01000001, B00110110, B00001000, B00000000, B00000000, // }
4, 8, B00001000, B00000100, B00001000, B00000100, B00000000, // ~
  };

void printCharWithShift(char c, int shift_speed) {
if (c < 32) return;
c -= 32;
memcpy_P(buffer, CH + 7 * c, 7);
m.writeSprite(32, 0, buffer);
m.setColumn(32 + buffer[0], 0);
•  for (int i = 0; i < buffer[0] + 1; i++)
{
delay(shift_speed);
m.shiftLeft(false, false);
}
}
void printStringWithShift(char* s, int shift_speed) {
while (*s != 0) {
printCharWithShift(*s, shift_speed);
s++;
}
}
void printString(char* s)
{
int col = 0;
while (*s != 0)
{
if (*s < 32) continue;
char c = *s - 32;
memcpy_P(buffer, CH + 7 * c, 7);
m.writeSprite(col, 0, buffer);
m.setColumn(col + buffer[0], 0);
col += buffer[0] + 1;
s++;
}
 }
code 4Arduino
/*
  8x8 Dot Matrix w/ MAX7219
  modified on 7 March 2019
  by Saeed Hosseini @ Electropeak
  https://electropeak.com/learn/
*/
#include <MaxMatrix.h>

int DIN = 7;
int CLK = 6;
int CS = 5;
int maxInUse = 2;

MaxMatrix m(DIN, CS, CLK, maxInUse);

byte pakman[] = {8, 8, 0x1c, 0x22, 0x41, 0x49, 0x55, 0x22, 0x00, 0x08};

void setup() {
  m.init();
  m.setIntensity(2);
}
void loop(){
  m.writeSprite(0, 0, pakman);
  delay(300);
  for (int i = 0; i < 8; i++) {
    m.shiftRight(false, true);
    delay(300);
  }
  m.clear();

}

Schematics

MaxMatrix Library
maxmatrix_USsbUIBFNZ.zip
LedControl Library
ledcontrol_u5YHgsGxkC.zip

Comments

Similar projects you might like

Current Temperature on 8*8 LED Dot Matrix

Project showcase by DHERSH M CHACKO and Nekhil ravi

  • 13,900 views
  • 17 comments
  • 44 respects

Analog Clock with LED Matrix and Arduino

Project in progress by LAGSILVA

  • 14,690 views
  • 13 comments
  • 51 respects

8x8 Dot Matrix

Project tutorial by RoboCircuits

  • 2,109 views
  • 2 comments
  • 6 respects

Amazing Binary Clock using LED Matrix Module

Project in progress by LAGSILVA

  • 10,253 views
  • 12 comments
  • 58 respects

LED Matrix Wave Moves With Hand

by Mostafa Abcreno

  • 4,793 views
  • 1 comment
  • 20 respects

Interfacing Arduino UNO with SURE Electronics LED Dot Matrix

Project tutorial by Arduino_Scuola

  • 3,992 views
  • 1 comment
  • 3 respects
Add projectSign up / Login