This is the original code that was using 8 individual display 7219 modules. But these keep locking up .
It is just a basic array, not using the parola library, I used the MaxMatrix.
I tried adding in the #define HARDWARE_TYPE MD_MAX72XX::FC16_HW for the newer displays, but that did not work.
So this is why I want new code using Parola and the 4 X Display modules FC16_HW
// maxmatrix-disp-scroll-text-7219
// based on
// https://code.google.com/p/arudino-maxmatrix-library/wiki/Example_Display_Scrolling_Text
#include <MaxMatrix.h>
#include <avr/pgmspace.h>
#define maxDisplays 8 // Number of MAX7219's in use.
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
byte Buf7219[7]; // "width,height,data[5]" single character buffer.
const int data = 11;//12; // DIN or MOSI DIN on display board ( data in )
const int load = 10; //10; // CS CS input on display board
const int clock = 13; //11; // SCK Clk input on display board ( Clock )
const int buttonPin0 = 2; // set the number of the push button pin input for display 0
const int buttonPin1 = 3; // set the number of the push button pin input for display 1
const int buttonPin2 = 4; // set the number of the push button pin input for display 2
const int buttonPin3 = 5; // set the number of the push button pin input for display 3
const int buttonPin4 = 6; // set the number of the push button pin input for display 4
const int buttonPin5 = 7; // set the number of the push button pin input for display 5
const int buttonPin6 = 8; // set the number of the push button pin input for display 6
const int buttonPin7 = 9; // set the number of the push button pin input for display 7
const int buttonPin8 = 13; // set the number of the push button pin input for display 8
const int buttonPin9 = A0; // set the number of the push button pin input for display 9
const int buttonPin10 = A1; // set the number of the push button pin input for display 10
const int buttonPin11 = A2; // set the number of the push button pin input for display 11
const int buttonPin12 = A3; // set the number of the push button pin input for display 12
const int buttonPin13 = A4; // set the number of the push button pin input for display 13
const int buttonPin14 = A5; // set the number of the push button pin input for display 14
const int relayPin = 1; // set pin 1 to be an output to relay
MaxMatrix m(data, load, clock, maxDisplays);
// Data array is stored in program memory (see memcpy_P for access).
// Parameters are width, height, character data...
// There is a speed improvement for characters with height 8 bits see lib.
PROGMEM const unsigned char CH[] = {
3, 8, B0000000, B0000000, B0000000, B0000000, B0000000, // space note the 3 sets the amount of columbs used, the 8 sets the row heights used
1, 8, B1011111, B0000000, B0000000, B0000000, B0000000, // !
3, 8, B0000011, B0000000, B0000011, B0000000, B0000000, // "
5, 8, B0010100, B0111110, B0010100, B0111110, B0010100, // #
4, 8, B0100100, B1101010, B0101011, B0010010, B0000000, // $
5, 8, B1100011, B0010011, B0001000, B1100100, B1100011, // %
5, 8, B0110110, B1001001, B1010110, B0100000, B1010000, // &
1, 8, B0000011, B0000000, B0000000, B0000000, B0000000, // '
3, 8, B0011100, B0100010, B1000001, B0000000, B0000000, // (
3, 8, B1000001, B0100010, B0011100, B0000000, B0000000, // )
5, 8, B0101000, B0011000, B0001110, B0011000, B0101000, // *
5, 8, B0001000, B0001000, B0111110, B0001000, B0001000, // +
2, 8, B10110000, B1110000, B0000000, B0000000, B0000000, // ,
4, 8, B0001000, B0001000, B0001000, B0001000, B0000000, // -
2, 8, B1100000, B1100000, B0000000, B0000000, B0000000, // .
4, 8, B1100000, B0011000, B0000110, B0000001, B0000000, // /
4, 8, B0111110, B1000001, B1000001, B0111110, B0000000, // 0
3, 8, B1000010, B1111111, B1000000, B0000000, B0000000, // 1
4, 8, B1100010, B1010001, B1001001, B1000110, B0000000, // 2
4, 8, B0100010, B1000001, B1001001, B0110110, B0000000, // 3
4, 8, B0011000, B0010100, B0010010, B1111111, B0000000, // 4
4, 8, B0100111, B1000101, B1000101, B0111001, B0000000, // 5
4, 8, B0111110, B1001001, B1001001, B0110000, B0000000, // 6
4, 8, B1100001, B0010001, B0001001, B0000111, B0000000, // 7
4, 8, B0110110, B1001001, B1001001, B0110110, B0000000, // 8
4, 8, B0000110, B1001001, B1001001, B0111110, B0000000, // 9
2, 8, B01010000, B0000000, B0000000, B0000000, B0000000, // :
2, 8, B10000000, B01010000, B0000000, B0000000, B0000000, // ;
3, 8, B0010000, B0101000, B1000100, B0000000, B0000000, // <
3, 8, B0010100, B0010100, B0010100, B0000000, B0000000, // =
3, 8, B1000100, B0101000, B0010000, B0000000, B0000000, // >
4, 8, B0000010, B1011001, B0001001, B0000110, B0000000, // ?
5, 8, B0111110, B1001001, B1010101, B1011101, B0001110, // @
4, 8, B1111110, B0010001, B0010001, B1111110, B0000000, // A
4, 8, B1111111, B1001001, B1001001, B0110110, B0000000, // B
4, 8, B0111110, B1000001, B1000001, B0100010, B0000000, // C
4, 8, B1111111, B1000001, B1000001, B0111110, B0000000, // D
4, 8, B1111111, B1001001, B1001001, B1000001, B0000000, // E
4, 8, B1111111, B0001001, B0001001, B0000001, B0000000, // F
4, 8, B0111110, B1000001, B1001001, B1111010, B0000000, // G
4, 8, B1111111, B0001000, B0001000, B1111111, B0000000, // H
3, 8, B1000001, B1111111, B1000001, B0000000, B0000000, // I
4, 8, B0110000, B1000000, B1000001, B0111111, B0000000, // J
4, 8, B1111111, B0001000, B0010100, B1100011, B0000000, // K
4, 8, B1111111, B1000000, B1000000, B1000000, B0000000, // L
5, 8, B1111111, B0000010, B0001100, B0000010, B1111111, // M
5, 8, B1111111, B0000100, B0001000, B0010000, B1111111, // N
4, 8, B0111110, B1000001, B1000001, B0111110, B0000000, // O
4, 8, B1111111, B0001001, B0001001, B0000110, B0000000, // P
4, 8, B0111110, B1000001, B1000001, B10111110, B0000000, // Q
4, 8, B1111111, B0001001, B0001001, B1110110, B0000000, // R
4, 8, B1000110, B1001001, B1001001, B0110010, B0000000, // S
5, 8, B0000001, B0000001, B1111111, B0000001, B0000001, // T
4, 8, B0111111, B1000000, B1000000, B0111111, B0000000, // U
5, 8, B0001111, B0110000, B1000000, B0110000, B0001111, // V
5, 8, B0111111, B1000000, B0111000, B1000000, B0111111, // W
5, 8, B1100011, B0010100, B0001000, B0010100, B1100011, // X
5, 8, B0000111, B0001000, B1110000, B0001000, B0000111, // Y
4, 8, B1100001, B1010001, B1001001, B1000111, B0000000, // Z
2, 8, B1111111, B1000001, B0000000, B0000000, B0000000, // [
4, 8, B0000001, B0000110, B0011000, B1100000, B0000000, // backslash
2, 8, B1000001, B1111111, B0000000, B0000000, B0000000, // ]
3, 8, B0000010, B0000001, B0000010, B0000000, B0000000, // hat
4, 8, B1000000, B1000000, B1000000, B1000000, B0000000, // _
2, 8, B0000001, B0000010, B0000000, B0000000, B0000000, // `
4, 8, B0100000, B1010100, B1010100, B1111000, B0000000, // a
4, 8, B1111111, B1000100, B1000100, B0111000, B0000000, // b
4, 8, B0111000, B1000100, B1000100, B0000000, B0000000, // c // JFM MOD.
4, 8, B0111000, B1000100, B1000100, B1111111, B0000000, // d
4, 8, B0111000, B1010100, B1010100, B0011000, B0000000, // e
3, 8, B0000100, B1111110, B0000101, B0000000, B0000000, // f
4, 8, B10011000, B10100100, B10100100, B01111000, B0000000, // g
4, 8, B1111111, B0000100, B0000100, B1111000, B0000000, // h
3, 8, B1000100, B1111101, B1000000, B0000000, B0000000, // i
4, 8, B1000000, B10000000, B10000100, B1111101, B0000000, // j
4, 8, B1111111, B0010000, B0101000, B1000100, B0000000, // k
3, 8, B1000001, B1111111, B1000000, B0000000, B0000000, // l
5, 8, B1111100, B0000100, B1111100, B0000100, B1111000, // m
4, 8, B1111100, B0000100, B0000100, B1111000, B0000000, // n
4, 8, B0111000, B1000100, B1000100, B0111000, B0000000, // o
4, 8, B11111100, B0100100, B0100100, B0011000, B0000000, // p
4, 8, B0011000, B0100100, B0100100, B11111100, B0000000, // q
4, 8, B1111100, B0001000, B0000100, B0000100, B0000000, // r
4, 8, B1001000, B1010100, B1010100, B0100100, B0000000, // s
3, 8, B0000100, B0111111, B1000100, B0000000, B0000000, // t
4, 8, B0111100, B1000000, B1000000, B1111100, B0000000, // u
5, 8, B0011100, B0100000, B1000000, B0100000, B0011100, // v
5, 8, B0111100, B1000000, B0111100, B1000000, B0111100, // w
5, 8, B1000100, B0101000, B0010000, B0101000, B1000100, // x
4, 8, B10011100, B10100000, B10100000, B1111100, B0000000, // y
3, 8, B1100100, B1010100, B1001100, B0000000, B0000000, // z
3, 8, B0001000, B0110110, B1000001, B0000000, B0000000, // {
1, 8, B1111111, B0000000, B0000000, B0000000, B0000000, // |
3, 8, B1000001, B0110110, B0001000, B0000000, B0000000, // }
4, 8, B0001000, B0000100, B0001000, B0000100, B0000000, // ~
};
void setup()
{
m.init();
m.setIntensity(1); // this sets the brightness of the display 1 lowest
pinMode(buttonPin0, INPUT); // Ok, so this is saying that pin 2 is going to be an input, string0 refer back to top of code for const int that sets the pin
pinMode(buttonPin1, INPUT); // Ok, so this is saying that pin 3 is going to be an input string1
pinMode(buttonPin2, INPUT); // Ok, so this is saying that pin 4 is going to be an input string2
pinMode(buttonPin3, INPUT); // Ok, so this is saying that pin 5 is going to be an input string3
pinMode(buttonPin4, INPUT); // Ok, so this is saying that pin 6 is going to be an input string4
pinMode(buttonPin5, INPUT); // Ok, so this is saying that pin 7 is going to be an input string5
pinMode(buttonPin6, INPUT); // Ok, so this is saying that pin 8 is going to be an input string6
pinMode(buttonPin7, INPUT); // Ok, so this is saying that pin 9 is going to be an input string7
pinMode(buttonPin8, INPUT); // Ok, so this is saying that pin 13 is going to be an input string8
pinMode(buttonPin9, INPUT); // Ok, so this is saying that pin A1 is going to be an input string9
pinMode(buttonPin10, INPUT); // Ok, so this is saying that pin A2 is going to be an input string10
pinMode(buttonPin11, INPUT); // Ok, so this is saying that pin A3 is going to be an input string11
pinMode(buttonPin12, INPUT); // Ok, so this is saying that pin A4 is going to be an input string12
pinMode(buttonPin13, INPUT); // Ok, so this is saying that pin A5 is going to be an input string13
pinMode(buttonPin14, INPUT); // Ok, so this is saying that pin A5 is going to be an input string14
pinMode(relayPin,OUTPUT); // define pin 9 as an output for mirror ball topper action
}
// Scrolling Text
char string0[] = " MAD MAGNETS ";
char string1[] = " REVERSE FLIPPERS ";
char string2[] = " DEAD FLIPPERS ";
char string3[] = " FLIPPER FRENZY ";
char string4[] = " MESS 5 ";
char string5[] = " TILT !!! ";
char string6[] = " LETS GET READY TO RUMBLE ! ";
char string7[] = " mess 8 ";
char string8[] = " RED SCORES ";
char string9[] = " BLUE SCORES ";
char string10[] = " RED PLAYER WINS ";
char string11[] = " BLUE PLAYER WINS ";
char string12[] = " BATTLE PINNY RED VS BLUE ";
char string13[] = " MESS 14 ";
char string14[] = " MOO ! MOO ! MOO ! ";
void loop()
{
delay(20); //DELAY WAS SET TO 100
m.shiftLeft(false, true); // m.shiftLeft(false, true);
m.clear(); // see if this clears the display, display ran good for 30mins so might work?
// This part of program with see if a display input is active and turn on the relay that shall power up the displays , this is via the group "OR" function
if(digitalRead(buttonPin0) == HIGH || (digitalRead(buttonPin1) == HIGH || (digitalRead(buttonPin2) == HIGH || (digitalRead(buttonPin3) == HIGH || (digitalRead(buttonPin4) == HIGH
|| (digitalRead(buttonPin5) == HIGH || (digitalRead(buttonPin6) == HIGH || (digitalRead(buttonPin7) == HIGH || (digitalRead(buttonPin8) == HIGH|| (digitalRead(buttonPin9) == HIGH
|| (digitalRead(buttonPin10) == HIGH || (digitalRead(buttonPin11) == HIGH || (digitalRead(buttonPin12) == HIGH || (digitalRead(buttonPin13) == HIGH || (digitalRead(buttonPin14) == HIGH)))))))))))))))
{
digitalWrite(relayPin,HIGH); //turn ON relay output if a display signal is required
}
else{digitalWrite(relayPin,LOW); //if the "OR" function is not TRUE then the output will turn off
// digitalWrite(relayPin,LOW); //turn OFF relay output if a dispal signal is required
}
if(digitalRead(buttonPin0) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string0,15); //scroll rate of text is set by number in brackets lower number is faster
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin1) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string1,15); //Delay is the last figure
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin2) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string2,15); //Delay is the last figure
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin3) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string3,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin4) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string4,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin5) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string5,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin6) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string6,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin7) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string7,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin8) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string8,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin9) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string9,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin10) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string10,50); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin11) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string11,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin12) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string12,20); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin13) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string13,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
if(digitalRead(buttonPin14) == HIGH)
{
delay (800);
m.clear(); //use this to clear the display of artifacts after text scrolls
printStringWithShift(string14,15); //scroll rate of text is set by number in brackets
m.clear(); //use this to clear the display of artifacts after text scrolls
}
}
void printCharWithShift(char c, int shift_speed)
{
if (c < 32) return;
c -= 32;
memcpy_P(Buf7219, CH + 7*c, 7);
m.writeSprite(maxDisplays*8, 0, Buf7219);
m.setColumn(maxDisplays*8 + Buf7219[0], 0);
for (int i=0; i<=Buf7219[0]; i++)
{
delay(shift_speed);
m.shiftLeft(false, false); //m.shiftLeft(false, false); change last argument from false to true
}
}
void printStringWithShift(char* s, int shift_speed)
{
while (*s != 0)
{
printCharWithShift(*s, shift_speed);
s++;
}
}