本文主要介绍基于MAX7219模块的LED点阵显示,完整代码见文末链接
一、简介
MAX7219模块实物如下图所示,MAX7219 是美国MAXIM 公司推出的多位LED 显示驱动器,采用3 线串行接口传送数据,可直接与单片机接口连接,用户能方便修改其内部参数,以实现多位LED 显示。它内含硬件动态扫描电路、BCD译码器、段驱动器和位驱动器。此外,其内部还含有8X8 位静态RAM用于存放8 个数字的显示数据。
本文主要介绍基于MAX7219和Arduino单片机实现的点阵屏显示功能,完成代码见文末链接,亲测OK
二、接线图
Arduino UNO | MAX7219点阵屏 |
---|---|
D7 | DIN |
D6 | CLK |
D5 | CS |
5V | VCC |
GND | GND |
三、部分程序代码(完整见文末链接)
#include <MaxMatrix.h>
int DIN = 7; // DIN pin of MAX7219 module
int CLK = 6; // CLK pin of MAX7219 module
int CS = 5; // CS pin of MAX7219 module
int maxInUse = 1;
MaxMatrix m(DIN, CS, CLK, maxInUse);
void loop() {
// Seting the LEDs On or Off at x,y or row,column position
m.setDot(6,2,true);
delay(1000);
m.setDot(6,3,true);
delay(1000);
m.clear(); // Clears the display
for (int i=0; i<8; i++){
m.setDot(i,i,true);
delay(300);
}
m.clear();
// Displaying the character at x,y (upper left corner of the character)
m.writeSprite(2, 0, A);
delay(1000);
m.writeSprite(2, 0, B);
delay(1000);
m.writeSprite(0, 0, smile01);
delay(1000);
m.writeSprite(0, 0, smile02);
delay(1000);
m.writeSprite(0, 0, smile03);
delay(1000);
for (int i=0; i<8; i++){
m.shiftLeft(false,false);
delay(300);
}
m.clear();
}
四、视频展示
Arduino--音乐频谱视频MAX7219
附完整代码链接(含代码所需头文件)
百度网盘提取:
链接:https://pan.baidu.com/s/1QMurwTWjnD-dgiIFkwo9Iw
提取码:f04o
CSDN提取:
https://download.csdn.net/download/u011816009/87176657