#include "MD_Parola.h"
#include "MD_MAX72xx.h"
#include "SPI.h"
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 4
const byte CS_PIN = 10;
const byte DATA_PIN = 11;
const byte CLK_PIN = 13;
const byte button1 = 9;
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
MD_Parola myDisplay1 = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
boolean message1;
boolean scroll;
boolean lastButtonState = LOW;
boolean arrayStart;
boolean arrayGo;
boolean stop;
int i;
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;
stop = true;
}
void loop() {
byte buttonState = digitalRead(button1);
if (buttonState == LOW) {
arrayStart = (arrayStart == true) ? false : true;
arrayGo = true;
stop = false;
i = 0;
}
if ((arrayStart == false) && (stop == false)) {
i = 7;//there are not seven strings stops an unwanted clich in led display
Serial.print("i");
Serial.println(i);
myDisplay1.displayClear();
stop = true;
}
if (arrayGo == true) {//buttonCount in previous codes can be changed to a boolean true/false
message1 = true;
arrayGo = false;
}
if (message1 == true) {
delay(500);
Serial.println(myStrings[i]);
Serial.print("i");
Serial.println(i);
myDisplay1.displayText(myStrings[i], PA_CENTER, 80, 0,
PA_SCROLL_LEFT, PA_SCROLL_LEFT);
scroll = true;
i++;
message1 = false;
if (i == 6) { //resets the string count
i = 0;
}
}
if (scroll == true) {
if (myDisplay1.displayAnimate()) {
myDisplay1.displayReset();
scroll = false;
if ((arrayStart == true) && (i <= 5)) {
arrayGo = true;
}
}
}
}