I'm trying to use a 8-digit Red LED display module 7 segment with a Mega 256 (based up MAX7219). I have this test program. The LedControl library I got from the Arduino libray site.
#include "LedControl.h"
const int DataIn = 10;
const int Clk = 12;
const int Load = 11;
LedControl lc = LedControl(DataIn, Clk, Load, 1);
unsigned long delaytime = 250;
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0, 1);
lc.clearDisplay(0);
}
void writeArduinoOn7Segment() {
lc.setChar(0, 7, 'a', false);
delay(delaytime);
lc.setChar(0, 6, 'r', false);
delay(delaytime);
lc.setChar(0, 5, 'd', false);
delay(delaytime);
lc.setChar(0, 4, 'u', false);
delay(delaytime);
lc.setChar(0, 3, 'i', false);
delay(delaytime);
lc.setChar(0, 2, 'n', false);
delay(delaytime);
lc.setChar(0, 1, 'o', false);
delay(delaytime);
lc.clearDisplay(0);
delay(delaytime);
}
void loop()
{
writeArduinoOn7Segment();
}
It constantly displays 'Arduino' on the display. When I connect the display module to a Uno and upload this program, it works fine. It continually displays 'Arduino' for as long as I keep the program running as expected.
However, if I compile and upload this program for a Mega 256, after a few seconds one or more letters doesn't display (just shows nothing in that position) and then after a few more seconds the whole display goes blank. If I power-off the Mega and power on again the same situation repeats.
On the Mega, I've tried changing the pins used (22 for 10, 23 for 11 and 24 for 12) but this has made no difference. Can any kind person advise why this is having problem on the Mega but works fine on the Uno.