【雕爷学编程】Arduino动手做(22)——8X8 LED点阵MAX7219屏6

37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止37种的。鉴于本人手头积累了一些传感器和模块,依照实践出真知(一定要动手做)的理念,以学习和交流为目的,这里准备逐一动手试试做实验,不管成功与否,都会记录下来—小小的进步或是搞不定的问题,希望能够抛砖引玉。

【Arduino】108种传感器模块系列实验(资料+代码+图形+仿真)
实验二十二:MAX7219点阵显示模块(8X8 LED共阴屏幕)

在这里插入图片描述

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二十二:MAX7219点阵显示模块(8X8 LED共阴)
项目三十三:动态红心

实验开源代码

/*【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)实验二十二:MAX7219点阵显示模块(8X8 LED共阴)项目三十三:动态红心接脚连线:MAX7219      UNOVCC  →→→→→ 5VGND  →→→→→ GNDDIN  →→→→→ D12(数据,数据接收引脚)CS   →→→→→ D11(负载,命令接收引脚)CLK  →→→→→ D10(时钟,时钟引脚)
*/unsigned char i;
unsigned char j; int Max7219_pinCLK = 10;
int Max7219_pinCS = 11;
int Max7219_pinDIN = 12;unsigned char disp1[19][8]={0x0c,0x1e,0x3e,0x7c,0x7c,0x3e,0x1e,0x0c};void Write_Max7219_byte(unsigned char DATA) 
{   unsigned char i;digitalWrite(Max7219_pinCS,LOW);  for(i=8;i>=1;i--){    digitalWrite(Max7219_pinCLK,LOW);digitalWrite(Max7219_pinDIN,DATA&0x80);DATA = DATA<<1;digitalWrite(Max7219_pinCLK,HIGH);}                                 
}void Write_Max7219(unsigned char address,unsigned char dat)
{digitalWrite(Max7219_pinCS,LOW);Write_Max7219_byte(address);          Write_Max7219_byte(dat);               digitalWrite(Max7219_pinCS,HIGH);
}void Init_MAX7219(void)
{Write_Max7219(0x09, 0x00);      Write_Max7219(0x0a, 0x03);      Write_Max7219(0x0b, 0x07);       Write_Max7219(0x0c, 0x01);      Write_Max7219(0x0f, 0x00);      
}void setup()
{pinMode(Max7219_pinCLK,OUTPUT);pinMode(Max7219_pinCS,OUTPUT);pinMode(Max7219_pinDIN,OUTPUT);delay(500);Init_MAX7219();
}void loop()
{ for(j=0;j<19;j++){for(i=1;i<9;i++)Write_Max7219(i,disp1[j][i-1]);delay(500);}   
}

在这里插入图片描述

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二十二:MAX7219点阵显示模块(8X8 LED共阴)
项目三十四:打开/关闭其 LED 组合显示 ASCII 字符

实验开源代码

/*【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)实验二十二:MAX7219点阵显示模块(8X8 LED共阴)项目三十四:打开/关闭其 LED 组合显示 ASCII 字符接脚连线:MAX7219      UNOVCC  →→→→→ 5VGND  →→→→→ GNDDIN  →→→→→ D12(数据,数据接收引脚)CS   →→→→→ D11(负载,命令接收引脚)CLK  →→→→→ D10(时钟,时钟引脚)
*///We always have to include the library
#include "LedControlMS.h"/*Now we need a LedControl to work with.***** These pin numbers will probably not work with your hardware *****pin 12 is connected to the DataIn pin 11 is connected to the CLK pin 10 is connected to LOAD We have only a single MAX72XX.*/
#define NBR_MTX 2 
LedControl lc=LedControl(12,10,11, NBR_MTX);String digits= "1234567890";
int digitCounter=0;
/* we always wait a bit between updates of the display */
unsigned long delaytime=300;void setup() {/*The MAX72XX is in power-saving mode on startup,we have to do a wakeup call*/Serial.begin (9600);Serial.println("Setup");digitCounter=0;for (int i=0; i< NBR_MTX; i++){lc.shutdown(i,false);/* Set the brightness to a medium values */lc.setIntensity(i,8);/* and clear the display */lc.clearDisplay(i);}Serial.println("LED0: 0 0");lc.setLed(0,0,0,true);delay(1000);Serial.println("LED0: 0 7");lc.setLed(0,0,7,true);delay(1000);Serial.println("LED0: 7 0");lc.setLed(0,7,0,true);delay(1000);Serial.println("LED0: 7 7");  lc.setLed(0,7,7,true);delay(1000);Serial.println("LED0: 0 0 off");lc.setLed(0,0,0,false);delay(1000);Serial.println("LED0: 0 7 off");lc.setLed(0,0,7,false);delay(1000);Serial.println("LED0: 7 0 off");lc.setLed(0,7,0,false);delay(1000);Serial.println("LED0: 7 7 off");  lc.setLed(0,7,7,false);delay(1000);  //clearAll();lc.setRow(0,1,0x0C);delay(1000);lc.clearDisplay(0);lc.setRow(0,1,0xC0);delay(1000);lc.clearDisplay(0);lc.setColumn(0,1,0x0C);delay(1000);lc.clearDisplay(0);lc.setColumn(0,1,0xC0);delay(1000);lc.clearDisplay(0);lc.writeString(0,"Hola Mundo");delay(1000);lc.clearAll();scrollLeft('O');delay(1000);lc.clearAll();scrollRight('O');delay(1000);lc.clearAll();
}void loop() { char ch= digits[digitCounter];digitCounter++;if (digitCounter>9) digitCounter=0;lc.displayChar(0, lc.getCharArrayPosition(ch));delay(500);lc.clearAll();delay(200);
}void scrollLeft(char ch){int pos =lc.getCharArrayPosition(ch);for (int scroll =0; scroll<6; scroll++) {for (int i=scroll; i<6;i++) {lc.setRow(0,i-scroll, alphabetBitmap[pos][i]);} delay(200);lc.clearDisplay(0);}
}void scrollRight(char ch){int pos =lc.getCharArrayPosition(ch);for (int scroll =0; scroll<8; scroll++) {for (int i=0; i<6;i++) {if (scroll+i<8) lc.setRow(0, scroll+i, alphabetBitmap[pos][i]);} delay(200);lc.clearDisplay(0);}
}

实验串口返回情况

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二十二:MAX7219点阵显示模块(8X8 LED共阴)
项目三十五:逐点排列

实验开源代码

/*【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)实验二十二:MAX7219点阵显示模块(8X8 LED共阴)项目三十五:逐点排列接脚连线:MAX7219      UNOVCC  →→→→→ 5VGND  →→→→→ GNDDIN  →→→→→ D12(数据,数据接收引脚)CS   →→→→→ D11(负载,命令接收引脚)CLK  →→→→→ D10(时钟,时钟引脚)
*///We always have to include the library
#include "LedControlMS.h"/*Now we need a LedControl to work with.***** These pin numbers will probably not work with your hardware *****pin 12 is connected to the DataIn pin 11 is connected to the CLK pin 10 is connected to LOAD We have only a single MAX72XX.*/
LedControl lc=LedControl(12,10,11,1);/* we always wait a bit between updates of the display */
unsigned long delaytime=100;void setup() {/*The MAX72XX is in power-saving mode on startup,we have to do a wakeup call*/lc.shutdown(0,false);/* Set the brightness to a medium values */lc.setIntensity(0,8);/* and clear the display */lc.clearDisplay(0);
}/*This method will display the characters for theword "Arduino" one after the other on the matrix. (you need at least 5x7 leds to see the whole chars)*/
void writeArduinoOnMatrix() {/* here is the data for the characters */byte a[5]={B01111110,B10001000,B10001000,B10001000,B01111110};byte r[5]={B00111110,B00010000,B00100000,B00100000,B00010000};byte d[5]={B00011100,B00100010,B00100010,B00010010,B11111110};byte u[5]={B00111100,B00000010,B00000010,B00000100,B00111110};byte i[5]={B00000000,B00100010,B10111110,B00000010,B00000000};byte n[5]={B00111110,B00010000,B00100000,B00100000,B00011110};byte o[5]={B00011100,B00100010,B00100010,B00100010,B00011100};/* now display them one by one with a small delay */lc.setRow(0,0,a[0]);lc.setRow(0,1,a[1]);lc.setRow(0,2,a[2]);lc.setRow(0,3,a[3]);lc.setRow(0,4,a[4]);delay(delaytime);lc.setRow(0,0,r[0]);lc.setRow(0,1,r[1]);lc.setRow(0,2,r[2]);lc.setRow(0,3,r[3]);lc.setRow(0,4,r[4]);delay(delaytime);lc.setRow(0,0,d[0]);lc.setRow(0,1,d[1]);lc.setRow(0,2,d[2]);lc.setRow(0,3,d[3]);lc.setRow(0,4,d[4]);delay(delaytime);lc.setRow(0,0,u[0]);lc.setRow(0,1,u[1]);lc.setRow(0,2,u[2]);lc.setRow(0,3,u[3]);lc.setRow(0,4,u[4]);delay(delaytime);lc.setRow(0,0,i[0]);lc.setRow(0,1,i[1]);lc.setRow(0,2,i[2]);lc.setRow(0,3,i[3]);lc.setRow(0,4,i[4]);delay(delaytime);lc.setRow(0,0,n[0]);lc.setRow(0,1,n[1]);lc.setRow(0,2,n[2]);lc.setRow(0,3,n[3]);lc.setRow(0,4,n[4]);delay(delaytime);lc.setRow(0,0,o[0]);lc.setRow(0,1,o[1]);lc.setRow(0,2,o[2]);lc.setRow(0,3,o[3]);lc.setRow(0,4,o[4]);delay(delaytime);lc.setRow(0,0,0);lc.setRow(0,1,0);lc.setRow(0,2,0);lc.setRow(0,3,0);lc.setRow(0,4,0);delay(delaytime);
}/*This function lights up a some Leds in a row.The pattern will be repeated on every row.The pattern will blink along with the row-number.row number 4 (index==3) will blink 4 times etc.*/
void rows() {for(int row=0;row<8;row++) {delay(delaytime);lc.setRow(0,row,B10100000);delay(delaytime);lc.setRow(0,row,(byte)0);for(int i=0;i<row;i++) {delay(delaytime);lc.setRow(0,row,B10100000);delay(delaytime);lc.setRow(0,row,(byte)0);}}
}/*This function lights up a some Leds in a column.The pattern will be repeated on every column.The pattern will blink along with the column-number.column number 4 (index==3) will blink 4 times etc.*/
void columns() {for(int col=0;col<8;col++) {delay(delaytime);lc.setColumn(0,col,B10100000);delay(delaytime);lc.setColumn(0,col,(byte)0);for(int i=0;i<col;i++) {delay(delaytime);lc.setColumn(0,col,B10100000);delay(delaytime);lc.setColumn(0,col,(byte)0);}}
}/* This function will light up every Led on the matrix.The led will blink along with the row-number.row number 4 (index==3) will blink 4 times etc.*/
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() { writeArduinoOnMatrix();rows();columns();single();
}

在这里插入图片描述

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二十二:MAX7219点阵显示模块(8X8 LED共阴)
项目三十六:快速扫描矩阵所以点

实验开源代码

/*【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)实验二十二:MAX7219点阵显示模块(8X8 LED共阴)项目三十六:快速扫描矩阵所以点接脚连线:MAX7219      UNOVCC  →→→→→ 5VGND  →→→→→ GNDDIN  →→→→→ D12(数据,数据接收引脚)CS   →→→→→ D11(负载,命令接收引脚)CLK  →→→→→ D10(时钟,时钟引脚)
*///We always have to include the library
#include "LedControlMS.h"/*Now we need a LedControl to work with.***** These pin numbers will probably not work with your hardware *****pin 12 is connected to the DataIn pin 11 is connected to the CLK pin 10 is connected to LOAD ***** Please set the number of devices you have *****But the maximum default of 8 MAX72XX wil also work.*/
LedControl lc=LedControl(12,10,11,1);/* we always wait a bit between updates of the display */
unsigned long delaytime=10;/* This time we have more than one device. But all of them have to be initialized individually.*/
void setup() {//we have already set the number of devices when we created the LedControlint devices=lc.getDeviceCount();//we have to init all devices in a loopfor(int address=0;address<devices;address++) {/*The MAX72XX is in power-saving mode on startup*/lc.shutdown(address,false);/* Set the brightness to a medium values */lc.setIntensity(address,8);/* and clear the display */lc.clearDisplay(address);}
}void loop() { //read the number cascaded devicesint devices=lc.getDeviceCount();//we have to init all devices in a loopfor(int row=0;row<8;row++) {for(int col=0;col<8;col++) {for(int address=0;address<devices;address++) {delay(delaytime);lc.setLed(address,row,col,true);delay(delaytime);lc.setLed(address,row,col,false);}}}
}

在这里插入图片描述
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二十二:MAX7219点阵显示模块(8X8 LED共阴)
项目三十七:动态字符串

实验开源代码

/*【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)实验二十二:MAX7219点阵显示模块(8X8 LED共阴)项目三十七:动态字符串接脚连线:MAX7219      UNOVCC  →→→→→ 5VGND  →→→→→ GNDDIN  →→→→→ D12(数据,数据接收引脚)CS   →→→→→ D11(负载,命令接收引脚)CLK  →→→→→ D10(时钟,时钟引脚)
*///We always have to include the library
#include "LedControlMS.h"/*Now we need a LedControl to work with.***** These pin numbers will probably not work with your hardware *****pin 12 is connected to the DataIn pin 11 is connected to the CLK pin 10 is connected to LOAD We have only a single MAX72XX.*/
LedControl lc=LedControl(12,10,11,1);/* we always wait a bit between updates of the display */
unsigned long delaytime=250;void setup() {/*The MAX72XX is in power-saving mode on startup,we have to do a wakeup call*/lc.shutdown(0,false);/* Set the brightness to a medium values */lc.setIntensity(0,8);/* and clear the display */lc.clearDisplay(0);
}/*This method will display the characters for theword "Arduino" one after the other on digit 0. */
void writeArduinoOn7Segment() {lc.setChar(2,0,'a',false);delay(delaytime);lc.setRow(2,0,0x05);delay(delaytime);lc.setChar(2,0,'d',false);delay(delaytime);lc.setRow(2,0,0x1c);delay(delaytime);lc.setRow(2,0,B00010000);delay(delaytime);lc.setRow(2,0,0x15);delay(delaytime);lc.setRow(2,0,0x1D);delay(delaytime);lc.clearDisplay(0);delay(delaytime);
} /*This method will scroll all the hexa-decimalnumbers and letters on the display. You will need at leastfour 7-Segment digits. otherwise it won't really look that good.*/
void scrollDigits() {for(int i=0;i<13;i++) {lc.setDigit(0,3,i,false);lc.setDigit(0,2,i+1,false);lc.setDigit(0,1,i+2,false);lc.setDigit(0,0,i+3,false);delay(delaytime);}lc.clearDisplay(0);delay(delaytime);
}void loop() { writeArduinoOn7Segment();scrollDigits();
}

Arduino点阵文字(中) 8x8 LED Matrix MAX7219 Tutorial with Scrolling Text

https://www.bilibili.com/video/BV1Et411k7U2?from=search&seid=4477785334025497564&spm_id_from=333.337.0.0

Arduino Nano + MAX7219 8*8点阵组合 汉字显示

https://www.bilibili.com/video/av375403904/?from=search&seid=3172695889868987008&spm_id_from=333.337.0.0

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/28790.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

OA系统增加会议

目录 一.前期准备工作 A.建立数据库会议信息类 B.建立增加会议的jsp界面 1.注意事项 2.存储路径图片展示 C.构建JS 1.构建addmetting.js 2.导入Layui的formSelects&#xff08;为了下拉框选择值做准备&#xff09; 二.实现绑定多功能下拉框dao方法 A.查询所有用户 绑…

arduinoIDE2.1.1最新版升级开发板(esp32-2.0.3升级2.0.10)方法总结(esp8266升级通用)

一、arduinoIDE 升级最新版 2.1.1方法 1.1.通过IDE2.x直接升级(推荐,速度还可以) 1.2.官网下载安装包覆盖升级(地址https://www.arduino.cc/en/software) 1.3 ESP8266升级方法雷同可参考(原理一样,最新好像是3.1.2) https://github.com/esp8266/Arduino/releases http…

应对突发流量,如何快速为自建 K8s 添加云上弹性能力

作者&#xff1a;庄宇 以 Kubernetes 为代表的容器技术带来的是一种应用交付模式的变革&#xff0c;其正迅速成为全世界数据中心的统一 API。 为了保证业务持续稳定、用户访问不中断&#xff0c;高可用、高弹性等能力是应用架构设计不变的追求&#xff0c;多集群架构天然具备…

Jmeter接口测试流程详解(中科软测认证中心)

1、jmeter简介 Jmeter是由Apache公司开发的java开源项目&#xff0c;所以想要使用它必须基于java环境才可以&#xff1b; Jmeter采用多线程&#xff0c;允许通过多个线程并发取样或通过独立的线程对不同的功能同时取样。 2、jmeter安装 首先需要安装jdk&#xff08;最好是最…

LCD-STM32液晶显示中英文-(7.字模及显示原理)

目录 字模介绍 什么是字模 字模的构成 字模显示原理 字模制作 如何制作字模 字模寻址公式 存储字模文件 字模介绍 什么是字模 有了编码&#xff0c;我们就能在计算机中处理、存储字符了&#xff0c;但是如果计算机处理完字符后直接以编码的形式输出&#xff0c;人类将难…

神器!基于ChatGPT模型的IDA插件

插件介绍 基于与 ChatGPT 相同模型的IDA 插件&#xff0c;使用 OpenAI 发布的 gpt-3.5-turbo 模型&#xff0c;可以有助于分析师们快速分析二进制文件。 关注【Hack分享吧】公众号&#xff0c;回复关键字【230719】获取下载链接 当前 WPeChatGPT 支持的功能包括&#xff1a; …

CSS 渐变边框及动画

转载请注明出处&#xff0c;点击此处 查看更多精彩内容 用 CSS 实现渐变边框及动画&#xff0c;下面对关键点进行解释说明&#xff0c;查看完整代码及预览效果请 点击这里。 简单说明原理&#xff1a;使用伪元素 ::before 绘制一个渐变色&#xff0c;然后使用伪元素 ::after 绘…

远程访问不了虚拟机【bug】

远程访问不了虚拟机【bug】 bug 虚拟机访问不了他的默认网关 虚拟机IP&#xff1a;172.25.254.250 虚拟机网关IP&#xff1a;172.25.254.1 远程登录也是超时的 错误产生 我还原了一下虚拟机的网络配置选项 导致 √ 使用本地DHCPT服务将IP地址给虚拟机 相关资源 本机的I…

二叉树(中)+Leetcode每日一题——“数据结构与算法”“剑指Offer55-I. 二叉树的深度”“100.相同的树”“965.单值二叉树”

各位CSDN的uu们你们好呀&#xff0c;今天继续数据结构与算法专栏中的二叉树&#xff0c;下面&#xff0c;让我们进入二叉树的世界吧&#xff01;&#xff01;&#xff01; 二叉树&#xff08;上&#xff09;——“数据结构与算法”_认真学习的小雅兰.的博客-CSDN博客 二叉树链…

ELK报错no handler found for uri and method [PUT] 原因

执行后提示no handler found for uri and method post&#xff0c;最新版8.2的问题&#xff1f; 原因&#xff1a; index.mapping.single_type: true在索引上 设置将启用按索引的单一类型行为&#xff0c;该行为将在6.0后强制执行。 原 {type} 要改为 _doc&#xff0c;格式如…

[游戏开发][Unity] TPS射击游戏相机实现

技术难点&#xff1a;由于是第三人称射击游戏&#xff0c;角色和相机之间有夹角&#xff0c;所以枪口点和准星是有误差的&#xff0c;下面是和平精英手游截图&#xff0c;我用AK射击zhuzi using System.Collections; using System.Collections.Generic; using UnityEngine;publ…

需求条目化与自动估算强强联合 助力软件估算自动化

痛点&#xff1a; 需求是产品的源头&#xff0c;是项目规模估算的基石。而传统的软件规模估算是由项目成员手工进行&#xff0c;对人员能力、经验、方法都有一定的要求&#xff0c;但是效果不好而且耗时费力&#xff0c;不能保持规模估算的一致性。 而导致这些问题的原因&#…