云天 发表于 2019-9-4 21:54:04

MAX7219LED点阵显示双位数字



    上面实现的是每隔一秒递减一位数字。
    如何实现上面的效果。
    首先,所使用的是df arduino Leonardo +扩展板,显示为MAX7219LED点阵。软件为MIND+。
    先用选择主板和扩展。
   
   2、使用“显示器”的显示图案,将数字显示出来,再利用“自动生成”查看代码。


3、在“手动编辑”代码修改如下,上传,完成!!!
#include <DFRobot_LedControl.h>
DFRobot_LedControl max7219(3, 5, 4);
const byte LedArray_left = {{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 = {{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=LedArray_left+LedArray_right;
      }
                   max7219.show(show);
          delay(1000);
    }

}



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

挺有趣的
页: [1]
查看完整版本: MAX7219LED点阵显示双位数字