Unicode characters on Max7219

I am trying to display unicode characters on Max7219 module, 4 x (8x8) matrix. Those letters are arabic/urdu. I am using MD_MX72xx and MD_Parola library.
Using MD_MX72xx its working fine and displaying the characters, but its not able to scroll it, Please let me know if I can scroll those characters as well as if I want to join them (removing space), how can it be done. here is the code I am trying, it also include the scrolling code but its not working as expected, Infact If I only use scrolling code it display nothing.
Please guide me on this.

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define  delay_t  50
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN   D6
#define DATA_PIN  D8
#define CS_PIN    D7

MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
MD_Parola parola = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);


byte toaay[8] = {0, 64, 64, 126, 80, 80, 32, 0,};
byte fay[8] = {112, 64, 64, 64, 112, 106, 112, 0, };
byte AinAlif[8] = {
  0, 62, 64, 64, 112, 72, 72, 72, 
};

void setup() {
 // Serial.begin(57600);
    mx.begin();
   mx.control(MD_MAX72XX::INTENSITY, 0);
  mx.control(MD_MAX72XX::UPDATE, MD_MAX72XX::ON);
  parola.begin();
  mx.clear();
}
bool isScroll = true;
void loop() {
  
  if(!isScroll){
    drawShape();
    isScroll = true;
    } 
    else{
  scrollCharacter();
    isScroll = false;
    }
}

void scrollCharacter() {
  byte rotatedAinAlif[8];
  byte rotatedToaay[8];
  byte rotatedFay[8];

  // Transpose characters
  for (int i = 0; i < 8; i++) {
    byte val = 0;
    for (int j = 0; j < 8; j++) {
      val |= ((AinAlif[j] >> i) & 0x01) << (7 - j);
    }
    rotatedAinAlif[i] = val;
  }

  for (int i = 0; i < 8; i++) {
    byte val = 0;
    for (int j = 0; j < 8; j++) {
      val |= ((toaay[j] >> i) & 0x01) << (7 - j);
    }
    rotatedToaay[i] = val;
  }

  for (int i = 0; i < 8; i++) {
    byte val = 0;
    for (int j = 0; j < 8; j++) {
      val |= ((fay[j] >> i) & 0x01) << (7 - j);
    }
    rotatedFay[i] = val;
  }

  // Scroll characters
  for (int j = 0; j < 8; j++) {
    for (int i = 0; i < 8; i++) {
      mx.setColumn(i, 0, mx.getColumn(i, 1));
      mx.setColumn(i, 1, mx.getColumn(i, 2));
      mx.setColumn(i, 2, mx.getColumn(i, 3));
    }
    mx.setColumn(7, 0, rotatedToaay[j]);
    mx.setColumn(7, 1, rotatedAinAlif[j]);
    mx.setColumn(7, 2, rotatedFay[j]);
    delay(delay_t);
  }
}


void drawShape() {
  byte rotatedAinAlif[8];
  byte rotatedToaay[8];
  byte rotatedFay[8];

  for (int i = 0; i < 8; i++) {
    byte val = 0;
    for (int j = 0; j < 8; j++) {
      val |= ((AinAlif[j] >> i) & 0x01) << (7 - j);
    }
    rotatedAinAlif[i] = val;
  }

  for (int i = 0; i < 8; i++) {
    byte val = 0;
    for (int j = 0; j < 8; j++) {
      val |= ((toaay[j] >> i) & 0x01) << (7 - j);
    }
    rotatedToaay[i] = val;
  }

  for (int i = 0; i < 8; i++) {
    byte val = 0;
    for (int j = 0; j < 8; j++) {
      val |= ((fay[j] >> i) & 0x01) << (7 - j);
    }
    rotatedFay[i] = val;
  }

  for (int i = 0; i <= 7; i++) {
    mx.setRow(0, i, rotatedAinAlif[i]);
  }
  delay(delay_t);
  for (int i = 0; i <= 7; i++) {
    mx.setRow(1, i, rotatedToaay[i]);
  }
  delay(delay_t);
  for (int i = 0; i <= 7; i++) {
    mx.setRow(2, i, rotatedFay[i]);
  }
}

Try the MD_Parola examples and fit your code to the example.

Thanks @xfpd , I already gone through with this, but facing issues in understanding, let me try it again.

If you search on "wokwi md_parola scroll text" you will find a good simulation to test your code (you also will find many broken simulations).

Don't mix MAX72xx and Parola. They are fighting for control of the display. If you are trying to display text then just use the Patola functions. Parola also has methods to control the spacing between letters and between words. Please read the documentation in the docs folder.

Have you defined an arabic/urdui font to display? I don't see that in the code.

1 Like

Thank you all who provide support, After reading it while sitting alone, I figure out the mistake that I was doing :slight_smile:

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