我有6条菊花链式MAX7219连接到arduino nano。 问题是它们全部都能正常工作,但仅保留前两个MAX7219的数据,其余七个段显示为空白。
Arduino代码-
#include <MAX72XX.h>
#include<SoftwareSerial.h>
#include "LedControl.h"
int a=1111;
int b=2222;
int c=3333;
int d=4444;
int e=5555;
int f=6666;
LedControl lc=LedControl(12,11,10,6);//(datain,clk,load)
unsigned long delaytime=250;
void setup() {
for(int address=0;address<6;address++) {
lc.shutdown(address,false);
/* Set the brightness to a medium values */
lc.setIntensity(address,7);
/* and clear the display */
lc.clearDisplay(address);
}
}
void loop() {
printNumber(a);
delay(250);
printNumber1(b);
delay(250);
printNumber2(c);
delay(250);
printNumber3(d);
delay(250);
printNumber4(e);
delay(250);
printNumber5(f);
delay(250);
}
void printNumber(int v) {
int ones;
int tens;
int hundreds;
int thousands;
ones=v%10;
v=v/10;
tens=v%10;
v=v/10;
hundreds=v%10;
v=v/10;
thousands=v;
lc.setDigit(0,0,(byte)thousands,false);
lc.setDigit(0,1,(byte)hundreds,false);
lc.setDigit(0,2,(byte)tens,false);
lc.setDigit(0,3,(byte)ones,false);
}
其余显示器具有类似的打印功能。