MD_Parola, scrolling text in multiple zones

I am a bit lost with this simple "hello world" sketch where I am trying to have two different texts scroll through two segments/zones.

After uploading this, only the text "Hello Zone 0" scrolls in zone 0. Zone 1 remains dark.

When changing the P.begin(0); to P.begin(8); and removing the comments for the static text lines below, both zones display their respective texts correctly, but without animation.

I tried almost everything vice versa and also consulted the docs, but I remain stuck with this.

Many thanks in advance for any comments,

Alex

// Program to demonstrate the MD_Parola library
//
// Simplest program that does something useful - Hello World!
//
// MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX
//
#include <stdio.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 8

#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10

// Hardware SPI connection
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary output pins
// MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

void setup(void)
{
  P.begin(0);
//P.begin(8);
  P.setZone(0,0,3);
  P.setZone(1,4,7);
  P.setSpeed(50);
}

void loop(void)
{

  if (P.displayAnimate())
    P.displayZoneText(1, "Hello Zone 1", PA_CENTER, P.getSpeed(), P.getPause(), PA_SCROLL_LEFT, PA_SCROLL_LEFT);
    
  if (P.displayAnimate())
    P.displayZoneText(0, "Hello Zone 0", PA_CENTER, P.getSpeed(), P.getPause(), PA_SCROLL_LEFT, PA_SCROLL_LEFT);

/*
  P.displayZoneText(0, "Zone 0", PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
  P.displayZoneText(1, "Zone 1", PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
  P.displayAnimate();
*/



}

For multi zone displays, this animates and returns true if ANY of the zone animations have completed. You need to interrogate each zone and see which one has completed. Please read the library documentation (in the library docs subfolder), look at how the multi-zone examples work (Parola_Zone_*.ino) or the double height examples and read the blog post https://arduinoplusplus.wordpress.com/2017/04/18/parola-a-to-z-multi-zone-displays/

Thanks for the advise. I had a look the blog post and the examples. With that I tried the following:

(all above void loop remained unchanged)

`void loop(void) {

  if (P.displayAnimate())
  {
    for (uint8_t i=0; i<MAX_ZONES; i++)
    {
      if (P.getZoneStatus(i))
      {
        P.displayZoneText(i, "Hello Zone 0 + 1", PA_CENTER, P.getSpeed(), P.getPause(), PA_SCROLL_LEFT, PA_SCROLL_LEFT);
        P.displayReset(i);
      }
    }
  }
}`

and this:

void loop(void) {

  P.displayAnimate();
  
  if (P.getZoneStatus(0) && P.getZoneStatus(1))
  {
    P.displayClear();
    P.displayZoneText(0, "Hello Zone 0", PA_CENTER, P.getSpeed(), P.getPause(), PA_SCROLL_LEFT, PA_SCROLL_LEFT);
    P.displayZoneText(1, "Hello Zone 1", PA_CENTER, P.getSpeed(), P.getPause(), PA_SCROLL_LEFT, PA_SCROLL_LEFT);
    P.synchZoneStart();
  }
}

Unfortunately both ways result in the same output and only zone 0 is animated. It seems I am missing some fundamental step in here....

Neither of these are correct.

It works with integrating this change as well, thanks marco_c.

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