#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
int clkPin = 52;
int dataPin = 51;
int csPin = 53;
int buttonPin = 2;
MD_Parola P = MD_Parola(MD_MAX72XX::PAROLA_HW, csPin, 11);
char swin[] = { "I love Swinburne " };
char name[] = { " Emily Dunn "};
int mil = 0;
int lastMil = 0;
void setup() {
P.begin();
//External interrupt for button rising
attachInterrupt(digitalPinToInterrupt(buttonPin), dispName, RISING);
}
void loop() {
//Scroll text across LED matrix
if (P.displayAnimate()) {
P.displayText(swin, PA_LEFT, 25, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}
}
//Interrupt function
void dispName() {
//Manual debounce
mil = millis();
if (mil - lastMil > 50) {
//Clear display and scroll name across LED matrix
P.displayClear();
P.displayText(name, PA_LEFT, 25, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
lastMil = mil;
}
}