3589浏览
查看: 3589|回复: 1

MAX7219LED点阵显示双位数字

[复制链接]
MAX7219LED点阵显示双位数字图2MAX7219LED点阵显示双位数字图3MAX7219LED点阵显示双位数字图1MAX7219LED点阵显示双位数字图4

    上面实现的是每隔一秒递减一位数字。
    如何实现上面的效果。
    首先,所使用的是df Arduino Leonardo +扩展板,显示为MAX7219LED点阵。软件为MIND+。
    先用选择主板和扩展。
   MAX7219LED点阵显示双位数字图5
   2、使用“显示器”的显示图案,将数字显示出来,再利用“自动生成”查看代码。
MAX7219LED点阵显示双位数字图6
MAX7219LED点阵显示双位数字图7
3、在“手动编辑”代码修改如下,上传,完成!!!
[mw_shl_code=c,true]#include <DFRobot_LedControl.h>
DFRobot_LedControl max7219(3, 5, 4);
const byte LedArray_left[10][8] = {{B00000000,B11100000,B10100000,B10100000,B10100000,B10100000,B10100000,B11100000},
{B00000000,B11000000,B01000000,B01000000,B01000000,B01000000,B01000000,B11100000},
{B00000000,B11100000,B00100000,B00100000,B11100000,B10000000,B10000000,B11100000},
{B00000000,B11100000,B00100000,B00100000,B11100000,B00100000,B00100000,B11100000},
{B00000000,B10100000,B10100000,B10100000,B11100000,B00100000,B00100000,B00100000},
{B00000000,B11100000,B10000000,B10000000,B11100000,B00100000,B00100000,B11100000},
{B00000000,B11100000,B10000000,B10000000,B11100000,B10100000,B10100000,B11100000},
{B00000000,B11100000,B00100000,B00100000,B00100000,B00100000,B00100000,B00100000},
{B00000000,B11100000,B10100000,B10100000,B11100000,B10100000,B10100000,B11100000},
{B00000000,B11100000,B10100000,B10100000,B11100000,B00100000,B00100000,B11100000}};
const byte LedArray_right[10][8] = {{B00000000,B00000111,B00000101,B00000101,B00000101,B00000101,B00000101,B00000111},
{B00000000,B00000110,B00000010,B00000010,B00000010,B00000010,B00000010,B00000111},
{B00000000,B00000111,B00000001,B00000001,B00000111,B00000100,B00000100,B00000111},
{B00000000,B00000111,B00000001,B00000001,B00000111,B00000001,B00000001,B00000111},
{B00000000,B00000101,B00000101,B00000101,B00000111,B00000001,B00000001,B00000001},
{B00000000,B00000111,B00000100,B00000100,B00000111,B00000001,B00000001,B00000111},
{B00000000,B00000111,B00000100,B00000100,B00000111,B00000101,B00000101,B00000111},
{B00000000,B00000111,B00000001,B00000001,B00000001,B00000001,B00000001,B00000001},
{B00000000,B00000111,B00000101,B00000101,B00000111,B00000101,B00000101,B00000111},
{B00000000,B00000111,B00000101,B00000101,B00000111,B00000001,B00000001,B00000111}};
byte show[]={B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000};
void setup() {
        max7219.begin();
       
}

void loop() {
    int m;
    int n;
   
          for (int i = 99; i> 0;i--) {
                  
                   m=int(i/10);
                   n=i%10;
                         for (int j = 0; j < 8; j++) {
               show[j]=LedArray_left[m][j]+LedArray_right[n][j];
      }
                   max7219.show(show);
            delay(1000);
    }

}
[/mw_shl_code]


gada888  版主

发表于 2019-10-16 21:05:57

挺有趣的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail