#include <MD_Parola.h>
#include <MD_MAX72xx.h>
const byte buttonPin = 2; // the pin that the pushbutton is attached to
char const* const names[] = {
"1",
"2",
"3",
"4",
"5",
"6",
};
size_t const names_count = sizeof(names) / sizeof(names[0]);
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
void setup() {
P.begin();
pinMode(buttonPin, INPUT_PULLUP);
while (digitalRead(buttonPin) == HIGH)
delay(100);
}
void loop() {
if (P.displayAnimate()) {
static uint8_t state = 0;
if (state == 0) {
P.displayText("Incoming wisdom...", PA_CENTER, 25, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
++state;
}
else if (state == 1) {
delay(1000);
static size_t index = 0;
P.displayText(names[index], PA_CENTER, 25, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
state = 0;
if (++index == names_count) {
index = 0;
}
}
{
while (digitalRead(buttonPin) == HIGH)
delay(100);
}
}
}