#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <ArduinoTrace.h>
#include "Bitmaps.h"
#include "Font.h"
// Define the number of devices we have in the chain and the hardware interface
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
//#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
// HARDWARE SPI
//MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// SOFTWARE SPI
MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
// Global data
typedef struct
{
textEffect_t effect; // text effect to display
char * psz; // text string nul terminated
uint16_t speed; // speed multiplier
uint16_t pause; // pause multiplier
} sCatalog;
// sCatalog catalog[] =
// {
// { PA_PRINT, "PRINT", 1, 1 },
// { PA_SLICE, "SLICE", 1, 1 },
// { PA_MESH, "MESH", 10, 1 },
// { PA_FADE, "FADE", 20, 1 },
// { PA_WIPE, "WIPE", 3, 1 },
// { PA_WIPE_CURSOR, "WPE_C", 4, 1 },
// { PA_OPENING, "OPEN", 3, 1 },
// { PA_OPENING_CURSOR, "OPN_C", 4, 1 },
// { PA_CLOSING, "CLOSE", 3, 1 },
// { PA_CLOSING_CURSOR, "CLS_C", 4, 1 },
// { PA_RANDOM, "RAND", 3, 1 },
// { PA_BLINDS, "BLIND", 7, 1 },
// { PA_DISSOLVE, "DSLVE", 7, 1 },
// { PA_SCROLL_UP, "SC_U", 5, 1 },
// { PA_SCROLL_DOWN, "SC_D", 5, 1 },
// { PA_SCROLL_LEFT, "SC_L", 5, 1 },
// { PA_SCROLL_RIGHT, "SC_R", 5, 1 },
// { PA_SCROLL_UP_LEFT, "SC_UL", 7, 1 },
// { PA_SCROLL_UP_RIGHT, "SC_UR", 7, 1 },
// { PA_SCROLL_DOWN_LEFT, "SC_DL", 7, 1 },
// { PA_SCROLL_DOWN_RIGHT, "SC_DR", 7, 1 },
// { PA_SCAN_HORIZ, "SCNH", 6, 1 },
// { PA_SCAN_HORIZX, "SCNHX", 6, 1 },
// { PA_SCAN_VERT, "SCNV", 6, 1 },
// { PA_SCAN_VERTX, "SCNVX", 6, 1 },
// { PA_GROW_UP, "GRW_U", 7, 1 },
// { PA_GROW_DOWN, "GRW_D", 7, 1 },
// };
sCatalog catalog[] =
{
{ PA_PRINT,"1",1,300},
{ PA_PRINT,"2",1,300},
{ PA_PRINT,"3",1,300},
{ PA_PRINT,"4",1,300},
{ PA_PRINT,"5",1,300},
{ PA_PRINT,"6",1,300},
{ PA_PRINT,"7",1,300},
};
uint16_t myAnimationSpeed;
void setup()
{
Serial.begin(57600);
myAnimationSpeed=500;
P.begin();
P.setFont(myFont);
P.addChar('|', VBlankLine);
P.addChar('1', ROMBO1);
P.addChar('2', ROMBO2);
P.addChar('3', ROMBO3);
P.addChar('4', ROMBO4);
P.addChar('5', ROMBO5);
P.addChar('6', ROMBO6);
P.addChar('7', ROMBO7);
// myAnimations addChar: REALIZAR
}
void loop()
{
myAnimation();
}
void myAnimation() //REALIZAR
{
for (uint8_t i=0; i<ARRAY_SIZE(catalog); i++)
{
P.displayText(catalog[i].psz,PA_CENTER,catalog[i].speed,0,PA_PRINT,PA_NO_EFFECT);
while (!P.displayAnimate());
delay(catalog[i].pause);
}
}