mdraber
Published © GPL3+

Create text animations with Parola Library for Arduino

Make cool looking text animations/transitions on 8x8 dot matrixes controlled by MAX7219 modules

IntermediateFull instructions provided4,179
Create text animations with Parola Library for Arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
4 x 8x8 Dot Matrix with MAX7219
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

MAX7219 - using Led Control library to display 8x8 bitmap on 4 8x8 matrixes

Arduino
//Mario's Ideas
//MAX7219 - using Led Control library to display 8x8 bitmap on 4 8x8 matrixes
#include <LedControl.h>

int DIN = 11;
int CS = 10;
int CLK = 13;
LedControl lc=LedControl(DIN, CLK, CS,4);
int active_display=0;

//int Cat[8] ={B10001000,B11111000,B10101000,B01110001,B00100001,B01111001,B01111101,B10111110 };
byte Apple [8]={B00011000,B00001000,B01110110,B11111111,B11111111,B11111111,B01111010,B00110100};

void setup() {
  for(int i=0;i<4;i++){
  lc.shutdown(i,false);
  lc.setIntensity(i,3);
  lc.clearDisplay(i);
  }
  delay(3000);
  for(int i=0;i<8;i++) lc.setRow(active_display,i,Apple[i]);
  delay(3000);
  lc.clearDisplay(0);
  delay(3000);
}
  
void loop(){
  
  for(int i=0;i<8;i++) lc.setRow(active_display,i,Apple[i]);
  delay(3000);
  lc.clearDisplay(active_display);
  active_display++;
  if (active_display==4) active_display=0;
}

MAX7219 - using Led Control library to scroll the sample text accross 4 8x8 matrixes

Arduino
// Mario's Ideas
//MAX7219 - using Led Control library to scroll the sample text accross 4 8x8 matrixes
#include <LedControl.h>

int DIN = 11;
int CS = 10;
int CLK = 13;
LedControl lc=LedControl(DIN, CLK, CS,4);

int position=0;

int Marios_ideas [8] [54] ={
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,1,0,0,0,1,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,0,0},
  {0,1,1,0,1,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0},
  {0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0},
  {0,1,0,0,0,1,0,1,1,1,1,0,1,1,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,0,1,0,0,1,0,1,1,1,0,1,1,1,1,0,0,1,1,0,0,0,0},
  {0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0},
  {0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,1,0,1,1,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0}
  };


void setup() {

  for(int i=0;i<4;i++){
  lc.shutdown(i,false);
  lc.setIntensity(i,3);
  lc.clearDisplay(i);
  }
  delay(3000);
}

void loop() {
  for (int j=0;j<9;j++){
    for (int i=0;i<8;i++){
    lc.setLed(0,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54+24]);
    lc.setLed(1,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54+16]);
    lc.setLed(2,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54+8]);
    lc.setLed(3,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54]);
    }
  }
  delay(20);
  position=position+1;
}  

MAX7219 - using Parola Library to create complex text animations/transition

Arduino
// Mario's Ideas
//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_SCROLL_LEFT, PA_SCROLL_LEFT , "Thanks for watching", 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}
};



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
  }    
}

Credits

mdraber

mdraber

47 projects • 65 followers

Comments