This is code using a 8 x 32 led dot matrix with a six string statement triggered by a button. When the button is pressed the statement start scrolling. After the first statement finishes the second one starts and so on. When finished with the sixth one it stops until button is pressed again.
#include "MD_Parola.h"
#include "MD_MAX72xx.h"
#include "SPI.h"
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
const byte CS_PIN = 12;
const byte DATA_PIN = 11;
const byte CLK_PIN = 13;
const byte button1 = 9;
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
MD_Parola myDisplay1 = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
boolean message1;
boolean scroll;
int i;
int x;
int buttonCount = 0;
char *myStrings[] = { "Greetings From West Virginia USA", "Hope Your Having An Awesome Day", "Please Dont Litter",
"Let Me Hold A Dollar", "Be Kind To Animals And Children", "Hope This Helps - JohnathonJ" };
void setup() {
Serial.begin(9600);
pinMode(button1, INPUT_PULLUP);
myDisplay.begin();
myDisplay.setIntensity(0);
myDisplay.setTextAlignment(PA_CENTER);
myDisplay.print("Ready");
delay(1000);
myDisplay.displayClear();
myDisplay1.begin();
myDisplay1.setIntensity(0);
message1 = false;
scroll = false;
}
void loop() {
if (digitalRead(button1) == LOW) {
delay(250);
buttonCount = 1;
x = 0;
i = 0;
}
if (buttonCount == 1) {
message1 = true;
buttonCount = 2;
}
if (message1 == true) {
delay(500);
Serial.println(myStrings[i]);
Serial.print("i");
Serial.println(i);
Serial.print("x");
Serial.println(x);
myDisplay1.displayText(myStrings[i], PA_CENTER, 80, 0,
PA_SCROLL_LEFT, PA_SCROLL_LEFT);
scroll = true;
i++;
x++;
message1 = false;
}
if (scroll == true) {
if (myDisplay1.displayAnimate()) {
myDisplay1.displayReset();
scroll = false;
if (x <= 5) {
buttonCount = 1;
}
}
}
}