problem with display string in MD_Parola multi zone

Dear all,
I am pretty new at arduino and in some project I need to display a string on dot matrix LEDs, the issue is that i need to show every character in a separate max device, so i decide to use MD_Parola zone capability and define a zone for each max device then display every character on a zone. the string must be read from another arduino (both boards are UNO) via I2C_Anything library.
The problem is that I can’t get any thing on the display if I change the source of “P.displayZoneText” to the string. I have tried to many ways and read the Parola A to Z instructions, they were helpful but I can’t start my display. even if I try to display a static string, still nothing happens.
I thing I need to change something in loop function and I have trying for lots of hours but not succeed.
here is the code:

#include <I2C_Anything.h> //to communicate with another uno
#include <Wire.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define I2C_SLAVE_ADDRESS 8
#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
#define MAX_DEVICES 4
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10

MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

char str[5];//string to display 

volatile boolean haveData = false;//for communication
void setup()
{
  P.begin(4);//here I set 4 zones for 4 characters, every character a zone
  P.setZone(0, 0, 0);
  P.setZone(1, 1, 1);
  P.setZone(2, 2, 2);
  P.setZone(3, 3, 3);
  P.displayZoneText(3, str[0], PA_CENTER, 25, 0, PA_PRINT, PA_NO_EFFECT);//this segment shows nothing I send letter "T" in order to complete the "TEST"
  P.displayZoneText(2, "E", PA_CENTER, 25, 0, PA_PRINT, PA_NO_EFFECT);//this works fine
  P.displayZoneText(1, "S", PA_CENTER, 25, 0, PA_PRINT, PA_NO_EFFECT);//this works fine
  P.displayZoneText(0, "T", PA_CENTER, 25, 0, PA_PRINT, PA_NO_EFFECT);//this works fine
  Serial.begin(500000);//while I starting the Serial.print(), I got nothing on any display
  Wire.begin(I2C_SLAVE_ADDRESS);//set Uno as slave 
  Wire.onReceive(receiveEvent);


}

void loop() {
  P.displayAnimate();
  //Serial.print(str[0]);Serial.print(str[1]);Serial.print(str[2]);Serial.println(str[3]); // If this line enables, the display shows nothing and also there is no output in Serial Monitor

/* I have tried lots of functions here such as P.displayReset(), P.getZoneStatus(3),strcpy(str[0],'T'),... in every differnt form and
 *  combination, but non of them is working for me.
 */

}

void receiveEvent (int howMany)
{
  if (howMany >= (sizeof str[0])
      + (sizeof str[1])
      + (sizeof str[2])
      + (sizeof str[3])
     )
  {

    I2C_readAnything (str[0]);
    I2C_readAnything (str[1]);
    I2C_readAnything (str[2]);
    I2C_readAnything (str[3]);

    haveData = true;
  }  // end if have enough data
}

Any help would be appreciated.

Have you tried Serial.print variable str to make sure it contains something?
Also, try P.print to the display as this does not need animate in loop().

Also, be aware of the difference between string and char. Str is a string if nul character terminated. Str[0] is a character.

Hi marco,

About the serialPrint,I have found that if I use Serial.print with P.displayAnimate() only, nothing at all shows on display and serial monitor but if put P.print() in loop the problem solve but only zone 0 is working!

because it seems to be confusing, I have changed the code to some simple ones in order to get better results.
if I just want to get some sting from I2C and use a P.print(), everything works fine so I think data from I2C is OK.
The reason I have used str[0] is that I want to separate each character from the string str, you are right about the the difference between string and character.

In the code below, i set 2 zones the zone #1 always shows letter ‘m’ and I tried to show letter ‘k’ in zone #0 in 4 different ways as mentioned. please take a look:

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>


#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
#define MAX_DEVICES 2
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10

MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

char str[5];//string to display


void setup()
{
  P.begin(2);//here I set 2 zones for 2 characters, every character a zone

  P.setZone(0, 0, 0);
  P.setZone(1, 1, 1);

  P.displayZoneText(1, "m", PA_CENTER, 25, 5, PA_PRINT, PA_NO_EFFECT);//zone 1 always show letter 'm'
  P.displayZoneText(0, str[0], PA_CENTER, 25, 5, PA_PRINT, PA_NO_EFFECT);//change in loop()

  Serial.begin(9600);


}

void loop() {
  P.displayAnimate();
  //str[0]="k";  //1. this shows nothing in zone 0
  //str[0]=107; //ACSII Code for letter 'k'  2. this shows nothing in zone 0
  //str[0]='k'; //3. this shows nothing in zone 0
  //P.print("k"); //4.can't select the zone number, onle zone 0 changes

  delay(500);
  //Serial.print(str[0]);Serial.print(str[1]);Serial.println(millis());// can't be used with   P.displayAnimate(); 

}

Please note my earlier comments about strings and characters.

This code

P.displayZoneText(0, str[0], PA_CENTER, 25, 5, PA_PRINT, PA_NO_EFFECT)

Is trying to display the character str[0], not the letter 'K' or whatever the first character is. It should be producing a compiler warning during compile.

The string "m" in memory is actually the characters 'm' followed by a '\0' (nul or ascii 0). The character str[0] is just a character and followed by any other rubbish that is in memory at the time, so it will probably never work as you expect (and in fact is probably crashing the program).

If you want to just display one character per module them a more appropriate option is to use the MD_MAX72xx library directly, or bypass the library altogether, as explained in the code attached to second of these two blog posts.