Running Text LED Matrix Parola Library - Esp8266
1 Chain LED Matrix 8 x 8
Arduino UNO
CODING:
LED Matrix 1 x 8 x 8 ESP8266
CODING:
//Jurnalku by Fajar Himawan
//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 1
#define CLK_PIN D5
#define DATA_PIN D7
#define CS_PIN D8
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 , "SMK Wachid Hasyim Surabaya ", 9, 0, PA_LEFT },
{ PA_RANDOM, PA_GROW_DOWN, "B", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "A", 1, 2 , PA_CENTER},
{ PA_BLINDS, PA_GROW_DOWN ,"I", 1, 2 ,PA_CENTER},
{ PA_SCROLL_DOWN_LEFT, PA_SCROLL_DOWN_LEFT ,"K", 1, 2 ,PA_LEFT},
{ PA_SCROLL_LEFT, PA_SCROLL_LEFT , "Robotika ", 9, 0, PA_LEFT },
{ PA_RANDOM, PA_GROW_DOWN, "R", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "O", 1, 2 , PA_CENTER},
{ PA_BLINDS, PA_GROW_DOWN ,"B", 1, 2 ,PA_CENTER},
{ PA_SCROLL_UP_RIGHT, PA_SCROLL_UP_RIGHT, "O", 1, 2 ,PA_RIGHT},
{ PA_SCROLL_DOWN_RIGHT, PA_SCROLL_DOWN_RIGHT, "T", 1, 2 , PA_CENTER},
{ PA_SCROLL_UP_RIGHT, PA_SCROLL_UP_RIGHT, "I", 1, 2 ,PA_LEFT},
{ PA_RANDOM, PA_GROW_DOWN, "K", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "A", 1, 2 , PA_CENTER},
{ PA_SCROLL_LEFT, PA_SCROLL_LEFT , "Jurnalku by Fajar Himawan ", 9, 0, PA_LEFT },
{ PA_RANDOM, PA_GROW_DOWN, "J", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "U", 1, 2 , PA_CENTER},
{ PA_BLINDS, PA_GROW_DOWN ,"R", 1, 2 ,PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "N", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "A", 1, 2 , PA_CENTER},
{ PA_BLINDS, PA_GROW_DOWN ,"L", 1, 2 ,PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "K", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "U", 1, 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(500);
i++; // then set up for next text effect
}
}
LED Matrix 4 x 8 x 8
ESP8266
CODING:
//Jurnalku by Fajar Himawan
//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 D5
#define DATA_PIN D7
#define CS_PIN D8
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 , "Selamat Hari Pahlawan dan tetap semangat berjuang raih prestasi ya:) dari Kami Robotika SMK Wachid Hasyim Surabaya ", 5, 0, PA_LEFT },
{ PA_SCROLL_LEFT, PA_SCROLL_LEFT , "SMK Wachid Hasyim Surabaya ", 9, 0, PA_LEFT },
{ PA_RANDOM, PA_GROW_DOWN, "B", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "A", 1, 2 , PA_CENTER},
{ PA_BLINDS, PA_GROW_DOWN ,"I", 1, 2 ,PA_CENTER},
{ PA_SCROLL_DOWN_LEFT, PA_SCROLL_DOWN_LEFT ,"K", 1, 2 ,PA_LEFT},
{ PA_SCROLL_LEFT, PA_SCROLL_LEFT , "Robotika ", 9, 0, PA_LEFT },
{ PA_RANDOM, PA_GROW_DOWN, "R", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "O", 1, 2 , PA_CENTER},
{ PA_BLINDS, PA_GROW_DOWN ,"B", 1, 2 ,PA_CENTER},
{ PA_SCROLL_UP_RIGHT, PA_SCROLL_UP_RIGHT, "O", 1, 2 ,PA_RIGHT},
{ PA_SCROLL_DOWN_RIGHT, PA_SCROLL_DOWN_RIGHT, "T", 1, 2 , PA_CENTER},
{ PA_SCROLL_UP_RIGHT, PA_SCROLL_UP_RIGHT, "I", 1, 2 ,PA_LEFT},
{ PA_RANDOM, PA_GROW_DOWN, "K", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "A", 1, 2 , PA_CENTER},
{ PA_SCROLL_LEFT, PA_SCROLL_LEFT , "Jurnalku by Fajar Himawan ", 9, 0, PA_LEFT },
{ PA_RANDOM, PA_GROW_DOWN, "J", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "U", 1, 2 , PA_CENTER},
{ PA_BLINDS, PA_GROW_DOWN ,"R", 1, 2 ,PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "N", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "A", 1, 2 , PA_CENTER},
{ PA_BLINDS, PA_GROW_DOWN ,"L", 1, 2 ,PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "K", 1, 2 , PA_CENTER},
{ PA_RANDOM, PA_GROW_DOWN, "U", 1, 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(500);
i++; // then set up for next text effect
}
}
No comments