3589| 1
|
MAX7219LED点阵显示双位数字 |
上面实现的是每隔一秒递减一位数字。 如何实现上面的效果。 首先,所使用的是df Arduino Leonardo +扩展板,显示为MAX7219LED点阵。软件为MIND+。 先用选择主板和扩展。 2、使用“显示器”的显示图案,将数字显示出来,再利用“自动生成”查看代码。 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] |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed