Howdy all,
I'm trying to figure out how to alternate a scrolling longer message with a short message using random animations, and can't seem to find a solution. I saw another post that was showing how to alternate the message to display by way of a switch input, and that's not quite what I'm after.
I'd like to have "Don't Panic!" print out in a scroll_left, and then after that print "THINK" using a random text effect in a loop. The code I have at the moment doesn't have any compiling errors, and loads to the ESP32 I'm using, but it just doesn't display the "Don't Panic!" part- I get the desired "THINK" with blank pauses in between.
I suspect my snag is in my if loop, having to do with the size of the text, but that's a guess.
Many thanks for help! Code is below. IDE 2.0.4 if that matters.
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
// Uncomment according to your hardware type
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
//#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
// Defining size, and output pins
#define MAX_DEVICES 4
#define CS_PIN 5
MD_Parola Display = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
int i = 0;
textEffect_t texteffect[] = {
PA_WIPE,
PA_WIPE_CURSOR,
PA_OPENING_CURSOR,
PA_CLOSING_CURSOR,
PA_BLINDS,
PA_MESH,
PA_OPENING,
PA_CLOSING,
PA_SCAN_VERT,
PA_DISSOLVE,
PA_RANDOM,
PA_PRINT,
PA_SCROLL_RIGHT,
PA_SCROLL_LEFT,
PA_GROW_UP,
PA_GROW_DOWN,
PA_SCROLL_UP,
PA_SCROLL_DOWN,
PA_SCROLL_UP_RIGHT,
PA_SCROLL_UP_LEFT,
PA_SCROLL_DOWN_RIGHT,
PA_SCROLL_DOWN_LEFT,
};
void setup() {
Display.begin();
Display.setIntensity(1);
Display.setSpeed(1000);
Display.getPause(1000);
Display.displayClear();
}
void loop() {
if (Display.displayAnimate()) {
if (i < sizeof(texteffect)) {
i++;
}
else {
i = 0;
}
Display.displayScroll("DON'T PANIC!", PA_RIGHT, PA_SCROLL_LEFT, 80);
Display.displayReset();
delay(2000);
Display.displayText("THINK", PA_CENTER, Display.getSpeed(), Display.getPause(), texteffect[i], texteffect[i]);
Display.displayReset();
delay(2000);
}
}