Lisleapex Blog
Published © Apache-2.0

MAX7219 Arduino Program 8×8 Cathode LED Dot Matrix Display

MAX7219 dot matrix module: It consists of one 8x8 common cathode dot matrix 1088AS and one MAX7219, and communicates with the microcontrolle

BeginnerWork in progress2 hours317
MAX7219 Arduino Program 8×8 Cathode LED Dot Matrix Display

Things used in this project

Hardware components

Max7219
×1
LoRa Module
Wireless-Tag LoRa Module
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

max7219_dot_matrix_module_schematic_diagram__pIdtzSM3Gc.jpg

Code

Untitled file

Arduino
//8*8LED dot matrix module display experiment

//Dot matrix displays up, down, left, right, and right arrows, three expressions, and three hearts



#include <LedControl.h>



//Arduino UNO SPI pins: D10 (CS), D11 (MOSI), D12 (MISO), D13 (SCLK)



int DIN = 11;//SPI mode, MOSI master device output, slave device input

int CS = 10;//SPI mode, CS chip select

int CLK = 13;//SPI mode, CLK



//Facial expression

byte smile[8] = {0x3C, 0x42, 0xA5, 0x81, 0xA5, 0x99, 0x42, 0x3C};//Smile

byte neutral[8] = {0x3C, 0x42, 0xA5, 0x81, 0xBD, 0x81, 0x42, 0x3C}; //Neutral

byte sad[8] = {0x3C, 0x42, 0xA5, 0x81, 0x99, 0xA5, 0x42, 0x3C}; //Sad



//Solid arrow

byte front[8] = {0x08, 0x1c, 0x3e, 0x7f, 0x1c, 0x1c, 0x1c, 0x1c}; //Upward arrow↑

byte back[8] = {0x1c, 0x1c, 0x1c, 0x1c, 0x7f, 0x3e, 0x1c, 0x08}; //Downward arrow↓

byte left[8] = {0x10, 0x30, 0x7f, 0xff, 0x7f, 0x30, 0x10, 0x00}; //Left arrow←

byte right[8] = {0x08, 0x0c, 0xfe, 0xff, 0xfe, 0x0c, 0x08, 0x00}; //Right arrow→



//Heart

byte heart[8] = {0x00, 0x76, 0x89, 0x81, 0x81, 0x42, 0x24, 0x18}; //Empty❤

byte heart1[8] = {0x00, 0x00, 0x24, 0x7E, 0x7E, 0x3C, 0x18, 0x00}; //Small❤

byte heart2[8] = {0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, 0x18}; //Big❤



LedControl lc = LedControl(DIN, CLK, CS, 0);//Create a new class object



void setup()

{

lc.shutdown(0, false); //Set the dot matrix to normal use mode during initialization

lc.setIntensity(0, 1); //Set the brightness value, range 0~15

lc.clearDisplay(0); //Dot matrix clear screen

}



void loop()

{

//Show arrow

printByte(Front);

delay(2000);

printByte(back);

delay(2000);

printByte(left);

delay(2000);

printByte(right);

delay(2000);



//Show expression

printByte(smile);

delay(2000);

printByte(neutral);

delay(2000);

printByte(sad);

delay(2000);



//Show❤

printByte(heart);

delay(2000);

printByte(heart1);

delay(2000);

printByte(heart2);

delay(2000);

}



void printByte(byte character [])

{

int i = 0;

for (i = 0; i < 8; i++)

{

lc.setRow(0, i, character[i]); //Set the state of 8 LEDs in a single row of dot matrix, and each row of data is represented in hexadecimal

}

}

Credits

Lisleapex Blog
24 projects • 0 followers
Fast Delivery of High-Quality Electronic Components

Comments