MD_Parola 项目使用教程

MD_Parola 项目使用教程

MD_ParolaLibrary for modular scrolling LED matrix text displays项目地址:https://gitcode.com/gh_mirrors/md/MD_Parola

1. 项目的目录结构及介绍

MD_Parola 项目的目录结构如下:

MD_Parola/
├── docs/
├── examples/
├── hardware/
├── media/
│   └── photo/
├── src/
├── .gitattributes
├── .gitignore
├── Doxyfile
├── ISSUE_TEMPLATE.md
├── LICENSE
├── PULL_REQUEST_TEMPLATE.md
├── README.md
├── keywords.txt
└── library.properties

目录介绍

  • docs/: 包含项目的文档文件。
  • examples/: 包含使用 MD_Parola 库的示例代码。
  • hardware/: 包含硬件相关的文档和配置文件。
  • media/photo/: 包含项目相关的图片资源。
  • src/: 包含 MD_Parola 库的源代码。
  • .gitattributes: Git 属性配置文件。
  • .gitignore: Git 忽略文件配置。
  • Doxyfile: Doxygen 配置文件,用于生成代码文档。
  • ISSUE_TEMPLATE.md: GitHub 问题模板文件。
  • LICENSE: 项目许可证文件,采用 LGPL-2.1 许可证。
  • PULL_REQUEST_TEMPLATE.md: GitHub 拉取请求模板文件。
  • README.md: 项目主页文件,包含项目的基本介绍和使用说明。
  • keywords.txt: Arduino 库管理器的关键词文件。
  • library.properties: Arduino 库属性文件。

2. 项目的启动文件介绍

项目的启动文件主要是 src/MD_Parola.hsrc/MD_Parola.cpp

MD_Parola.h

这是 MD_Parola 库的头文件,定义了库的主要类和接口。

MD_Parola.cpp

这是 MD_Parola 库的实现文件,包含了类的具体实现和功能代码。

3. 项目的配置文件介绍

项目的配置文件主要是 library.properties

library.properties

这个文件是 Arduino 库的属性文件,包含以下关键信息:

  • name: 库的名称,这里是 MD_Parola
  • version: 库的版本号。
  • author: 库的作者,这里是 majicDesigns
  • maintainer: 库的维护者,这里是 marco_c
  • sentence: 库的简短描述。
  • paragraph: 库的详细描述。
  • category: 库的分类,这里是 Display
  • url: 库的下载地址。
  • architectures: 支持的架构,这里是 *,表示支持所有架构。

这些配置信息帮助 Arduino IDE 正确识别和管理库。

MD_ParolaLibrary for modular scrolling LED matrix text displays项目地址:https://gitcode.com/gh_mirrors/md/MD_Parola

  • 17
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下使用MAX7219四合一点阵模块模拟不同声音频率的示例代码,该代码使用Arduino编写: ``` #include <MD_Parola.h> #include <MD_MAX72xx.h> #include <SPI.h> #define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW #define MAX_DEVICES 4 #define CLK_PIN 13 #define DATA_PIN 11 #define CS_PIN 10 MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES); void setup() { P.begin(); P.setIntensity(5); P.displayText("Sound Frequency", PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT); } void loop() { int frequency = 200; // starting frequency int delayTime = 500; // starting delay time int maxFrequency = 2000; // maximum frequency int minFrequency = 200; // minimum frequency int maxDelay = 1000; // maximum delay time int minDelay = 50; // minimum delay time int currentDelay = delayTime; int currentFrequency = frequency; int i = 0; while (true) { // calculate the current delay and frequency based on the counter currentDelay = map(i, 0, 100, maxDelay, minDelay); currentFrequency = map(i, 0, 100, minFrequency, maxFrequency); // update the display with the current frequency P.displayText(String(currentFrequency) + "Hz", PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT); // generate the sound by toggling the LED matrix for (int j = 0; j < 8; j++) { for (int k = 0; k < 8; k++) { if ((j + k) % 2 == 0) { P.setLed(j, k, true); } else { P.setLed(j, k, false); } } } // delay for the current delay time delay(currentDelay); // turn off the LED matrix to create a pause between sounds for (int j = 0; j < 8; j++) { for (int k = 0; k < 8; k++) { P.setLed(j, k, false); } } // delay for the current delay time delay(currentDelay); // increment the counter i++; if (i > 100) { i = 0; } } } ``` 该代码使用MAX7219四合一点阵模块模拟不同声音频率,并在LED矩阵上显示当前频率。在循环中使用计数器来计算当前延迟时间和频率,并使用LED矩阵生成声音。每个声音都由一个短暂的闪烁和一个短暂的暂停组成,以便模拟不同的声音频率。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

苏承根

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值