MAX7219 and Parola- how to alternate between two messages?

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);

  }
}

You cannot just put in delay()s and expect it to work, as the animations only progress when the displayAnimate() method is called. You should change over the message when displayAnimate() returns true - that is when the animation is finished.

Look at the library examples, there are lots that use change the message.

Are you referring to the MD_Parola examples? I see examples that relate to multiple text messages (received via serial interface) but I'm meaning to have them display differently with no input or changes. Can you post me to the example you think would help? Thank you (seriously- I'm grateful)

There are lots of ways to do it. However, to see WHERE you need to do it, then relevant examples could be Fonts or Scrolling. You will need to keep track of which message is currently displayed so that you can show the next one (hint, this is the same technique as keeping track of which animation type you are on in your current code).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.