// Mario's Ideas
// https://www.youtube.com/watch?v=oZDFh95Tt_E
// https://www.hackster.io/mdraber/create-text-animations-with-parola-library-for-arduino-b67955
//MAX7219 - using Parola Library to create complex text animations/transition
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#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, CS_PIN, MAX_DEVICES);
struct animations
{
textEffect_t anim_in; // Animation type
textEffect_t anim_out;// Animation type
const char * textOut; // Text to display
uint16_t speed; // Animation speed (multiplier for library default)
uint16_t pause; // pause (multiplier for library default)
textPosition_t just;
};
animations animList[] =
{
{ PA_PRINT, PA_PRINT, "Print", 4, 2, PA_CENTER},
{ PA_SCROLL_LEFT, PA_SCROLL_LEFT , "Thanks for watching", 4, 0, PA_LEFT },
{ PA_SCROLL_UP, PA_SCROLL_UP , "Sco Up", 4, 0, PA_LEFT },
{ PA_SLICE, PA_GROW_DOWN, "LIKE", 1, 2 , PA_CENTER },
{ PA_RANDOM, PA_GROW_DOWN, "SHARE", 1, 2 , PA_CENTER},
{ PA_SCROLL_LEFT, PA_SCROLL_LEFT ,"Subscribe", 5, 0 ,PA_LEFT},
{ PA_BLINDS, PA_GROW_DOWN ,"Patreon", 2, 2 ,PA_CENTER},
{ PA_SCROLL_DOWN_LEFT, PA_SCROLL_DOWN_LEFT ,"SEE", 4, 2 ,PA_LEFT},
{ PA_SCROLL_UP_RIGHT, PA_SCROLL_UP_RIGHT, "YOU", 4, 2 ,PA_RIGHT},
{ PA_SCROLL_DOWN_RIGHT, PA_SCROLL_DOWN_RIGHT, "SOON", 4, 2 , PA_CENTER}
/* PA_NO_EFFECT Used as a place filler, executes no operation.
PA_PRINT Text just appears (printed)
PA_SCROLL_UP Text scrolls up through the display.
PA_SCROLL_DOWN Text scrolls down through the display.
PA_SCROLL_LEFT Text scrolls right to left on the display.
PA_SCROLL_RIGHT Text scrolls left to right on the display.
PA_SPRITE Text enters and exits using user defined sprite.
PA_SLICE Text enters and exits a slice (column) at a time from the right.
PA_MESH Text enters and exits in columns moving in alternate direction (U/D)
PA_FADE Text enters and exits by fading from/to 0 and intensity setting.
PA_DISSOLVE Text dissolves from one display to another.
PA_BLINDS Text is replaced behind vertical blinds.
PA_RANDOM Text enters and exits as random dots.
PA_WIPE Text appears/disappears one column at a time, looks like it is wiped on and off.
PA_WIPE_CURSOR WIPE with a light bar ahead of the change.
PA_SCAN_HORIZ Scan the LED column one at a time then appears/disappear at end.
PA_SCAN_HORIZX Scan a blank column through the text one column at a time then appears/disappear at end.
PA_SCAN_VERT Scan the LED row one at a time then appears/disappear at end.
PA_SCAN_VERTX Scan a blank row through the text one row at a time then appears/disappear at end.
PA_OPENING Appear and disappear from the center of the display, towards the ends.
PA_OPENING_CURSOR OPENING with light bars ahead of the change.
PA_CLOSING Appear and disappear from the ends of the display, towards the middle.
PA_CLOSING_CURSOR CLOSING with light bars ahead of the change.
PA_SCROLL_UP_LEFT Text moves in/out in a diagonal path up and left (North East)
PA_SCROLL_UP_RIGHT Text moves in/out in a diagonal path up and right (North West)
PA_SCROLL_DOWN_LEFT Text moves in/out in a diagonal path down and left (South East)
PA_SCROLL_DOWN_RIGHT Text moves in/out in a diagonal path down and right (North West)
PA_GROW_UP Text grows from the bottom up and shrinks from the top down.
PA_GROW_DOWN Text grows from the top down and and shrinks from the bottom up. */
};
void setup() {
P.begin();
for (uint8_t i=0; i<ARRAY_SIZE(animList); i++)
{
animList[i].speed *= P.getSpeed(); animList[i].pause *= 500;
}
}
void loop() {
static uint8_t i = 0; // text effect index
if (P.displayAnimate())// animates and returns true when an animation is completed
{
if (i == ARRAY_SIZE(animList))i = 0; // reset loop index
P.displayText(animList[i].textOut, animList[i].just, animList[i].speed,
animList[i].pause, animList[i].anim_in, animList[i].anim_out);
delay(1000);
i++; // then set up for next text effect
}
}