|
|
(未显示7个用户的128个中间版本) |
第1行: |
第1行: |
− | {{Language|Microduino Matrix screen}}
| + | === 详细内容 === |
| | | |
− | {| style="width: 800px;"
| + | 此部分内容维基现已停止维护,该部分的详细内容全部转移至IdeaLab网站上,请移步[https://www.idealab.cc/course/5a69513f8459d000199e6cca/class/5a5855c8fec664000f6a7c69 点阵屏幕——制作]上进行查看。以下是IdeaLab访问流程。 |
− | |-
| |
− | |
| |
− | ==概述==
| |
− | *项目名称:Microduino LED点阵屏幕
| |
− | *目的:了解Microduino DcolorMatrix 点阵屏幕的原理
| |
− | *难度:低级
| |
− | *耗时:1小时
| |
− | *制作者:Microduino Studio-YLB
| |
| | | |
− | ==材料清单== | + | == IdeaLab访问流程 == |
− | *Microduino设备
| + | '''1、打开网址([http://www.idealab.cc/ https://www.idealab.cc/])。''' |
− | {|class="wikitable"
| |
− | |-
| |
− | |模块||数量||功能
| |
− | |-
| |
− | |[[Microduino-Core/zh]]||1||核心板
| |
− | |-
| |
− | |[[Microduino-USBTTL/zh]] ||1||下载程序
| |
− | |-
| |
− | |}
| |
− | *其他设备
| |
− | {|class="wikitable"
| |
− | |-
| |
− | ||Microduino LEDMatrix||1||显示
| |
− | |-
| |
− | |USB数据线||1||供电,下载
| |
− | |-
| |
− | |}
| |
| | | |
− | ==文档==
| + | '''2、点击右上角登录按钮。''' |
− | IIC驱动库:
| |
− | Adafruit-LED-Backpack-Library:https://github.com/adafruit/Adafruit-LED-Backpack-Library
| |
| | | |
− | 图形库:
| + | [[文件:1.png]] |
− | Adafruit-GFX-Library:https://github.com/adafruit/Adafruit-GFX-Library
| |
| | | |
| + | '''3、登录/注册账号。''' |
| | | |
− | '''注意:如果需要画图,必须把Adafruit-GFX-Library也拷贝到IDE的libraries里'''
| + | [[文件:2.png]] |
| | | |
− | 测试程序:'''[[File: _01_Microduino_DotMatrix.zip]]'''
| + | '''4、点击课程,在课程列表中找到《Microduino创新编程》课程并点击打开。''' |
| | | |
− | ===调试===
| + | [[文件:8.png]] |
− | 步骤一:将microduino模块叠在一块(Microduino Core + Microduino USBTTL + Microduino-Cube-S1),连接LEDMatrix与Cube-S1的IIC引脚。
| |
| | | |
− | 步骤二:下载使用到的库,将其解压到IDE的libraries文件夹内。
| + | '''5、点击“报名学习”。''' |
| | | |
− | 步骤三:下载示例程序并打开,编译通过后选择好板卡(Microduino Core)直接下载。
| + | [[文件:9.png]] |
| | | |
− | 成功的话则可以在点阵屏上显示0到50计数和流动显示mcookie字符,由于点阵分辨率只有8*8,因此20以后的数字屏幕会显示不全。(下一篇教程中会有多个点阵屏幕级联)
| + | '''6、输入姓名。''' |
− | [[File: LEDMatrix.jpg|600px|center|thumb]]
| |
| | | |
− | *程序
| + | [[文件:5.png]] |
− | <source lang="cpp">
| |
− | #include "Microduino_Matrix.h"
| |
| | | |
− | uint8_t Addr[MatrixPix_X][MatrixPix_Y] = {
| + | '''7、点击“课程目录”。''' |
− | { 64} //IIC address
| |
− | };
| |
− | Matrix display = Matrix(Addr);
| |
| | | |
− | void setup() {
| + | [[文件:10.png]] |
− | Serial.begin(115200); // See the connection status in Serial Monitor
| |
− | Wire.begin();
| |
| | | |
− | //getDeviceAddr
| + | '''8、选择相应课程进行学习。''' |
− | for (int a = 0; a < display.getMatrixNum(); a++) {
| |
− | Serial.print(display.getDeviceAddr(a));
| |
− | Serial.print(" ");
| |
− | }
| |
− | Serial.println("");
| |
| | | |
− | //setLedColor
| + | [[文件:11.png]] |
− | for (int y = 0; y < display.getHeight() * 8; y++) {
| |
− | for (int x = 0; x < display.getWidth() * 8; x++) {
| |
− | randomSeed(analogRead(A0));
| |
− | display.setLedColor(x, y, random(0, 255), random(0, 255), random(0, 255)); //x, y, r, g, b
| |
− | delay(5);
| |
− | }
| |
− | }
| |
− | delay(1000);
| |
− | display.clearDisplay();
| |
− | | |
− | //clearColor
| |
− | display.clearColor();
| |
− | //writeString H
| |
− | display.writeString("Microduino", MODE_H, 20, 0); //string, MODE, time ,y
| |
− | display.clearDisplay();
| |
− | //writeString V
| |
− | display.writeString("Microduino", MODE_V, 20, 0); //string, MODE, time ,x
| |
− | display.clearDisplay();
| |
− | }
| |
− | | |
− | int i;
| |
− | void loop() {
| |
− | i = display.getStringWidth("mCookie!");
| |
− | display.setColor(255, 255, 0);
| |
− | display.setFontMode(MODE_H);
| |
− | for (int a = display.getWidth() * 8; a > -i - display.getWidth() * 8; a--) {
| |
− | display.setCursor(a, 0); //x, y
| |
− | display.print("mCookie!");
| |
− | delay(20);
| |
− | }
| |
− | display.clearDisplay();
| |
− | | |
− | i = display.getStringHeight("mCookie!");
| |
− | display.setColor(255, 0, 255);
| |
− | display.setFontMode(MODE_V);
| |
− | for (int a = display.getHeight() * 8; a > -i - display.getHeight() * 8; a--) {
| |
− | display.setCursor(0, a); //x, y
| |
− | display.print("mCookie!");
| |
− | delay(20);
| |
− | }
| |
− | display.clearDisplay();
| |
− | | |
− | unsigned long timer = millis();
| |
− | display.setColor(0, 255, 255);
| |
− | display.setFontMode(MODE_H);
| |
− | while (millis() - timer < 5000) {
| |
− | display.setCursor(0, 0); //x, y
| |
− | display.print((millis() - timer) / 100);
| |
− | delay(20);
| |
− | }
| |
− | display.clearDisplay();
| |
− | }
| |
− | </source>
| |
− | | |
− | 代码uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { 64 }中的64指的是DcolorMatrix模块的iic地址,要设置DcolorMatrix模块的iic地址,先要清楚模块的iic地址表示方式。先按着模块背面的按键,再接上电源,待屏幕变白色后应立即放开手,屏幕有多少个白格子代表iic地址就是多少,比如图中的iic地址就是60。
| |
− | [[File: anjian.jpg|500px|left]]
| |
− | [[File: gezi.png|500px|top]] | |
− | | |
− | 如果屏幕亮的时候时候所有格子都是白色也不可认为此模块的iic地址就是64,可能会溢出,需要手动调。慢按背面按键是加一,快按背面按键是减一,按住不放即可设置成功。(例如想设置成60,在快速按按键减到60时长按等屏幕关闭即可)
| |