HELP!!!! How can I adjust code to rotate LED MAX7219 matrix text 90 or 270°

Please see this youtube video for my question

I had written that code for a demo example for the french forum a while back, check the rotate90CW() and rotate90CCW() functions

/***********************************************************************
   Affiche un message puis toutes les lettres de l'alphabet et tous les
  chiffres, un apres l'autre, sur 4 matrices de LEDs 8x8 Verticales
 ************************************************************************/

#include <LedControl.h> //  bibliotheque LEDControl
const byte NB_MAX7219 = 4;// 1 pour indiquer qu'il n'y a qu'un seul MAX7219, ici on en a 4
const byte CS = 10;// pin 10 de l'Arduino branchée a (CS)
const byte CLK = 11;// pin 11 de l'Arduino branchée a (CLK)
const byte DIN = 12;// pin 12 de l'Arduino branchée a (DIN)
LedControl lc = LedControl(DIN, CLK, CS, NB_MAX7219);

byte afficheur[8 * NB_MAX7219];

// tableau de chiffre et lettres - octets contenant l'état de chaque LED
// calculés pour un afficheur en vertical
const byte alphabet[37][8] = {
  {B00000000, B00000000, B00111110, B01010001, B01001001, B01000101, B00111110, B00000000}, //0
  {B00000000, B00000000, B00000000, B00000001, B01111111, B00100001, B00000000, B00000000}, //1
  {B00000000, B00000000, B00110001, B01001001, B01000101, B01000011, B00100001, B00000000}, //2
  {B00000000, B00000000, B01000110, B01101001, B01010001, B01000001, B01000010, B00000000}, //3
  {B00000000, B00000000, B00000100, B01111111, B00100100, B00010100, B00001100, B00000000}, //4
  {B00000000, B00000000, B01001110, B01010001, B01010001, B01010001, B01110010, B00000000}, //5
  {B00000000, B00000000, B00000110, B01001001, B01001001, B00101001, B00011110, B00000000}, //6
  {B00000000, B00000000, B01100000, B01010000, B01001000, B01000100, B01000011, B00000000}, //7
  {B00000000, B00000000, B00110110, B01001001, B01001001, B01001001, B00110110, B00000000}, //8
  {B00000000, B00000000, B00111100, B01001010, B01001001, B01001001, B00110000, B00000000}, //9
  {B00000000, B00000000, B00111111, B01001000, B01001000, B01001000, B00111111, B00000000}, //A
  {B00000000, B00000000, B00110110, B01001001, B01001001, B01001001, B01111111, B00000000}, //B
  {B00000000, B00000000, B00100010, B01000001, B01000001, B01000001, B00111110, B00000000}, //C
  {B00000000, B00000000, B00111110, B01000001, B01000001, B01000001, B01111111, B00000000}, //D
  {B00000000, B00000000, B01000001, B01001001, B01001001, B01001001, B01111111, B00000000}, //E
  {B00000000, B00000000, B01000000, B01001000, B01001000, B01001000, B01111111, B00000000}, //F
  {B00000000, B00000000, B00100110, B01000101, B01000001, B01000001, B00111110, B00000000}, //G
  {B00000000, B00000000, B01111111, B00001000, B00001000, B00001000, B01111111, B00000000}, //H
  {B00000000, B00000000, B00000000, B01000001, B01111111, B01000001, B00000000, B00000000}, //I
  {B00000000, B00000000, B01000000, B01111110, B01000001, B00000001, B00000010, B00000000}, //J
  {B00000000, B00000000, B01000001, B00100010, B00010100, B00001000, B01111111, B00000000}, //K
  {B00000000, B00000000, B00000000, B00000001, B00000001, B00000001, B01111111, B00000000}, //L
  {B00000000, B00000000, B01111111, B00100000, B00011000, B00100000, B01111111, B00000000}, //M
  {B00000000, B00000000, B01111111, B00000100, B00001000, B00010000, B01111111, B00000000}, //N
  {B00000000, B00000000, B00111110, B01000001, B01000001, B01000001, B00111110, B00000000}, //O
  {B00000000, B00000000, B00110000, B01001000, B01001000, B01001000, B01111111, B00000000}, //P
  {B00000000, B00000000, B00111101, B01000010, B01000101, B01000001, B00111110, B00000000}, //Q
  {B00000000, B00000000, B00110001, B01001010, B01001100, B01001000, B01111111, B00000000}, //R
  {B00000000, B00000000, B01000110, B01001001, B01001001, B01001001, B00110001, B00000000}, //S
  {B00000000, B00000000, B01000000, B01000000, B01111111, B01000000, B01000000, B00000000}, //T
  {B00000000, B00000000, B01111110, B00000001, B00000001, B00000001, B01111110, B00000000}, //U
  {B00000000, B00000000, B01111000, B00000110, B00000001, B00000110, B01111000, B00000000}, //V
  {B00000000, B00000000, B01111110, B00000001, B00001110, B00000001, B01111110, B00000000}, //W
  {B00000000, B00000000, B01100011, B00010100, B00001000, B00010100, B01100011, B00000000}, //X
  {B00000000, B00000000, B01100000, B00010000, B00001111, B00010000, B01100000, B00000000}, //Y
  {B00000000, B00000000, B01100001, B01010001, B01001001, B01000101, B01000011, B00000000}, //Z
  {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000}  //space or unknown
};




void switchOffDisplay()
{
  for (int index = 0; index < NB_MAX7219; index++)lc.shutdown(index, true);
}

void switchOnDisplay()
{
  for (int index = 0; index < NB_MAX7219; index++)lc.shutdown(index, false);
}

void displaySymbol(int charNb, byte n)
{
  for (int ligne = 0; ligne < 8; ligne++)
    lc.setRow(n, ligne, alphabet[charNb][ligne]);
}

void showAfficheur()
{
  for (int n = 0; n < NB_MAX7219; n++) {
    for (int l = 0; l < 8; l++)
      lc.setRow(NB_MAX7219 - 1 - n, l, afficheur[8 * n + l]);
  }
}

void rotate90CW()
{
  byte tmpGrid[8];
  for (int n = 0; n < NB_MAX7219; n++) {
    memset ( tmpGrid, 0, sizeof(tmpGrid));
    for (byte r = 0; r < 8; r++)
      for (byte b = 0; b < 8; b++)
        if (bitRead(afficheur[8 * n + b], r)) bitSet(tmpGrid[7 - r], b);
    for (byte r = 0; r < 8; r++) afficheur[8 * n + r] = tmpGrid[r];
  }
}

void rotate90CCW()
{
  byte tmpGrid[8];
  for (int n = 0; n < NB_MAX7219; n++) {
    memset ( tmpGrid, 0, sizeof(tmpGrid));
    for (byte r = 0; r < 8; r++)
      for (byte b = 0; b < 8; b++)
        if (bitRead(afficheur[8 * n + 7 - b], r)) bitSet(tmpGrid[r], b);
    for (byte r = 0; r < 8; r++) afficheur[8 * n + r] = tmpGrid[r];
  }
}


void pushChar(const char aChar, unsigned long scrollSpeed)
{
  byte currentPattern[8];
  byte tmpGrid[8];

  if ((aChar >= '0') && (aChar <= '9')) {
    for (int j = 0; j < 8; j++) currentPattern[j] = alphabet[aChar - '0'][j];
  } else if ((toupper(aChar) >= 'A') && (toupper(aChar) <= 'Z')) {
    for (int j = 0; j < 8; j++) currentPattern[j] = alphabet[toupper(aChar) - 'A' + 10][j];
  } else
    for (int j = 0; j < 8; j++) currentPattern[j] = alphabet[36][j];

  memset ( tmpGrid, 0, sizeof(tmpGrid));
  for (byte r = 0; r < 8; r++)
    for (byte b = 0; b < 8; b++)
      if (bitRead(currentPattern[b], r)) bitSet(tmpGrid[7 - r], b);
  for (byte r = 0; r < 8; r++) currentPattern[r] = tmpGrid[r];

  for (byte r = 0; r < 8; r++) {
    rotate90CW();
    for (int l = 1; l < 8 * NB_MAX7219; l++) afficheur[l - 1] = afficheur[l];
    afficheur[8 * NB_MAX7219 - 1] = currentPattern[r];
    rotate90CCW();
    showAfficheur(); delay(scrollSpeed);
  }
}

void scrollTxt(const char * aString, unsigned long scrollSpeed, bool preloadDisplay)
{
  int strLength = strlen(aString);
  int currentChar = 0;

  memset (afficheur, 0, sizeof(afficheur));
  if (preloadDisplay) {
    // preload the display
    for (currentChar = 0; currentChar < NB_MAX7219; currentChar++) {
      if (currentChar < strLength) {
        if ((aString[currentChar] >= '0') && (aString[currentChar] <= '9')) {
          for (int j = 0; j < 8; j++) afficheur[8 * currentChar + j] = alphabet[aString[currentChar] - '0'][j];
        } else if ((toupper(aString[currentChar]) >= 'A') && (toupper(aString[currentChar]) <= 'Z')) {
          for (int j = 0; j < 8; j++) afficheur[8 * currentChar + j] = alphabet[toupper(aString[currentChar]) - 'A' + 10][j];
        } else
          for (int j = 0; j < 8; j++) afficheur[8 * currentChar + j] = alphabet[36][j];
      }
    }
    showAfficheur(); delay(scrollSpeed * 4ul);
  }

  while (currentChar < strLength + NB_MAX7219) {
    byte currentPattern[8];
    byte tmpGrid[8];
    if ( currentChar < strLength) pushChar(aString[currentChar], scrollSpeed);
    else pushChar(' ', scrollSpeed); // pad with spaces
    currentChar++;
  }
}


void showCharacters()
{
  for (char i = '0'; i <= '9'; i++) pushChar(i, 10ul);
  pushChar(' ', 10ul);
  for (char i = 'A'; i <= 'Z'; i++) pushChar(i, 10ul);
  pushChar(' ', 10ul);
  pushChar(' ', 10ul);
  pushChar(' ', 10ul);
  pushChar(' ', 10ul);
}



void setup()
{
  Serial.begin(115200);
  for (int index = 0; index < NB_MAX7219; index++) { // NB_MAX7219 similar to lc.getDeviceCount()
    lc.shutdown(index, false);// interruption du mode "économie d'énergie" (toujours actif au démarrage)
    lc.setIntensity(index, 4); // réglage d'intensité (0~15)
    lc.clearDisplay(index);// on éteint toutes les LEDs
  }
}


void loop()
{
  const char sentence[] = "MY ARDUINO IS REALLY COOL";

  scrollTxt(sentence, 100ul, true);
  delay(1000);
  showCharacters();
  delay(1000);
}

Thanks for the reply I take it that I would insert 90 or 270 between () depending on CW or CCW? If so would I need to insert this into all () following CW CCW? Like below.

void rotate90CW()
{
  byte tmpGrid[8];
  for (int n = 0; n < NB_MAX7219; n++) {
    memset ( tmpGrid, 0, sizeof(tmpGrid));
    for (byte r = 0; r < 8; r++)
      for (byte b = 0; b < 8; b++)
        if (bitRead(afficheur[8 * n + b], r)) bitSet(tmpGrid[7 - r], b);
    for (byte r = 0; r < 8; r++) afficheur[8 * n + r] = tmpGrid[r];
  }
}

void rotate90CCW(270)
{
  byte tmpGrid[8];
  for (int n = 0; n < NB_MAX7219; n++) {
    memset ( tmpGrid, 0, sizeof(tmpGrid));
    for (byte r = 0; r < 8; r++)
      for (byte b = 0; b < 8; b++)
        if (bitRead(afficheur[8 * n + 7 - b], r)) bitSet(tmpGrid[r], b);
    for (byte r = 0; r < 8; r++) afficheur[8 * n + r] = tmpGrid[r];
  }

If I done the above what would I put here?

  for (byte r = 0; r < 8; r++) {
    rotate90CW();
    for (int l = 1; l < 8 * NB_MAX7219; l++) afficheur[l - 1] = afficheur[l];
    afficheur[8 * NB_MAX7219 - 1] = currentPattern[r];
    rotate90CCW();
    showAfficheur(); delay(scrollSpeed);

Also would you have any idea where I can get this in English as I cannot speak French? :confused:

well I wrote it all myself with french comments.. so it does not exist with english comments...

you could paste the code into google translate though and the comments should become understandable...

I take it that I would insert 90 or 270 between () depending on CW or CCW

No... the functions take no parameters and perform what the name imply:

the code relies on a global array, byte afficheur[8 * NB_MAX7219]; (afficheur means "a display") that is the buffer of all the pixels and how they should be, ON or OFF. (bit = 1 associated LED is on, bit = 0 associated LED is off). as your display have rows or line of 8 LEDs, a byte (8 bits) represents such a line. each matrix has 8 lines, so I need 8 bytes to represent a matrix, and you have 4 matrix in your example so you need 8x4 bytes to memorize what the display needs to look like. I store the number of Matrix in the NB_MAX7219 constant, so that's why my array has 8 * NB_MAX7219 for a size.

what the 2 functions do is basically rotate the by 90° in one direction or the other the content of this buffer.

rotate90CW() will rotate by 90° in the clockwise direction. call it twice if you want 180° or 3 times if you want 270°.

rotate90CCW() will rotate by 90° in the counter clockwise direction (so giving you the same result as calling the previous function 3 times)

So what would I input if I wanted to rotate it 3 times CCW?

Cannot get this to work correctly? I'm really confused sorry.

connect your 4x matrix and run my code. have a look at what it does and then explore how it works

J-M-L:
connect your 4x matrix and run my code. have a look at what it does and then explore how it works

I have and on yours it scrolls from bottom to top but I need it to go left to right, sorry I am new to this and also with the French its making it confusing plus I need to add other characters like smaller case and some symbols like on my original code used. Sorry to be a pain but i'm still trying to learn.

nothing wrong with the questions don’t worry.

I’ve not seen your original code. where did you post?

what do you mean by “horizontal”?
adding characters is not difficult, just need to draw them in a 8x8 matrix and code with 1 the LEDs that are ON and 0 the ones that are OFF

→ look at my code

 const byte alphabet[37][8] = {
  {B00000000, B00000000, B00111110, B01010001, B01001001, B01000101, B00111110, B00000000}, //0
  {B00000000, B00000000, B00000000, B00000001, B01111111, B00100001, B00000000, B00000000}, //1
  {B00000000, B00000000, B00110001, B01001001, B01000101, B01000011, B00100001, B00000000}, //2
  {B00000000, B00000000, B01000110, B01101001, B01010001, B01000001, B01000010, B00000000}, //3
  {B00000000, B00000000, B00000100, B01111111, B00100100, B00010100, B00001100, B00000000}, //4
  {B00000000, B00000000, B01001110, B01010001, B01010001, B01010001, B01110010, B00000000}, //5
  {B00000000, B00000000, B00000110, B01001001, B01001001, B00101001, B00011110, B00000000}, //6
  {B00000000, B00000000, B01100000, B01010000, B01001000, B01000100, B01000011, B00000000}, //7
  {B00000000, B00000000, B00110110, B01001001, B01001001, B01001001, B00110110, B00000000}, //8
  {B00000000, B00000000, B00111100, B01001010, B01001001, B01001001, B00110000, B00000000}, //9
  {B00000000, B00000000, B00111111, B01001000, B01001000, B01001000, B00111111, B00000000}, //A
  {B00000000, B00000000, B00110110, B01001001, B01001001, B01001001, B01111111, B00000000}, //B
  {B00000000, B00000000, B00100010, B01000001, B01000001, B01000001, B00111110, B00000000}, //C
  {B00000000, B00000000, B00111110, B01000001, B01000001, B01000001, B01111111, B00000000}, //D
  {B00000000, B00000000, B01000001, B01001001, B01001001, B01001001, B01111111, B00000000}, //E
  {B00000000, B00000000, B01000000, B01001000, B01001000, B01001000, B01111111, B00000000}, //F
  {B00000000, B00000000, B00100110, B01000101, B01000001, B01000001, B00111110, B00000000}, //G
  {B00000000, B00000000, B01111111, B00001000, B00001000, B00001000, B01111111, B00000000}, //H
  {B00000000, B00000000, B00000000, B01000001, B01111111, B01000001, B00000000, B00000000}, //I
  {B00000000, B00000000, B01000000, B01111110, B01000001, B00000001, B00000010, B00000000}, //J
  {B00000000, B00000000, B01000001, B00100010, B00010100, B00001000, B01111111, B00000000}, //K
  {B00000000, B00000000, B00000000, B00000001, B00000001, B00000001, B01111111, B00000000}, //L
  {B00000000, B00000000, B01111111, B00100000, B00011000, B00100000, B01111111, B00000000}, //M
  {B00000000, B00000000, B01111111, B00000100, B00001000, B00010000, B01111111, B00000000}, //N
  {B00000000, B00000000, B00111110, B01000001, B01000001, B01000001, B00111110, B00000000}, //O
  {B00000000, B00000000, B00110000, B01001000, B01001000, B01001000, B01111111, B00000000}, //P
  {B00000000, B00000000, B00111101, B01000010, B01000101, B01000001, B00111110, B00000000}, //Q
  {B00000000, B00000000, B00110001, B01001010, B01001100, B01001000, B01111111, B00000000}, //R
  {B00000000, B00000000, B01000110, B01001001, B01001001, B01001001, B00110001, B00000000}, //S
  {B00000000, B00000000, B01000000, B01000000, B01111111, B01000000, B01000000, B00000000}, //T
  {B00000000, B00000000, B01111110, B00000001, B00000001, B00000001, B01111110, B00000000}, //U
  {B00000000, B00000000, B01111000, B00000110, B00000001, B00000110, B01111000, B00000000}, //V
  {B00000000, B00000000, B01111110, B00000001, B00001110, B00000001, B01111110, B00000000}, //W
  {B00000000, B00000000, B01100011, B00010100, B00001000, B00010100, B01100011, B00000000}, //X
  {B00000000, B00000000, B01100000, B00010000, B00001111, B00010000, B01100000, B00000000}, //Y
  {B00000000, B00000000, B01100001, B01010001, B01001001, B01000101, B01000011, B00000000}, //Z
  {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000}  //space or unknown

each line is a char, for example if you take the first line: B00000000, B00000000, B00111110, B01010001, B01001001, B01000101, B00111110, B00000000

00000000		........
00000000		........
00[color=blue]1[/color][color=blue]1[/color][color=blue]1[/color][color=blue]1[/color][color=blue]1[/color]0		..[color=blue]*[/color][color=blue]*[/color][color=blue]*[/color][color=blue]*[/color][color=blue]*[/color].
0[color=blue]1[/color]0[color=blue]1[/color]000[color=blue]1[/color]		.[color=blue]*[/color].[color=blue]*[/color]...[color=blue]*[/color]
0[color=blue]1[/color]00[color=blue]1[/color]00[color=blue]1[/color]		.[color=blue]*[/color]..[color=blue]*[/color]..[color=blue]*[/color]
0[color=blue]1[/color]000[color=blue]1[/color]0[color=blue]1[/color]		.[color=blue]*[/color]...[color=blue]*[/color].[color=blue]*[/color]
00[color=blue]1[/color][color=blue]1[/color][color=blue]1[/color][color=blue]1[/color][color=blue]1[/color]0		..[color=blue]*[/color][color=blue]*[/color][color=blue]*[/color][color=blue]*[/color][color=blue]*[/color].
00000000		........

do you see the ZERO symbol?

Take a look at my YouTube video linked in original question and there is a link to the code I used in the description. Thanks

why would I watch code in youTube??? post code here... this is the forum.. let's keep things here and not go fund google advertising bucket...

It is easier if you post code in this forum. Please use code tags </>.

Depending on your requirements, the Parola library may do the job for you. See the links in my signature block - couple of videos there to see if it does what you need. You will also need MD_MAX72xx from the same site and will need to follow the instructions for how to change the header file to tell the library which type of matrix you have. All the matrices seem to be wired differently, which is what causes the odd scrolling pattern that you saw, so the library compensates for that.

Sorry I wasn’t at my computer thats why I said to look at my youtube video to get code from description, anyway here it is.

#include <MaxMatrix.h>
#include <avr/pgmspace.h>

PROGMEM const char CH[] = {
  3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
  1, 8, B01011111, B00000000, B00000000, B00000000, B00000000, // !
  3, 8, B00000011, B00000000, B00000011, B00000000, B00000000, // "
  5, 8, B00010100, B00111110, B00010100, B00111110, B00010100, // #
  4, 8, B00100100, B01101010, B00101011, B00010010, B00000000, // $
  5, 8, B01100011, B00010011, B00001000, B01100100, B01100011, // %
  5, 8, B00110110, B01001001, B01010110, B00100000, B01010000, // &
  1, 8, B00000011, B00000000, B00000000, B00000000, B00000000, // '
  3, 8, B00011100, B00100010, B01000001, B00000000, B00000000, // (
  3, 8, B01000001, B00100010, B00011100, B00000000, B00000000, // )
  5, 8, B00101000, B00011000, B00001110, B00011000, B00101000, // *
  5, 8, B00001000, B00001000, B00111110, B00001000, B00001000, // +
  2, 8, B10110000, B01110000, B00000000, B00000000, B00000000, // ,
  4, 8, B00001000, B00001000, B00001000, B00001000, B00000000, // -
  2, 8, B01100000, B01100000, B00000000, B00000000, B00000000, // .
  4, 8, B01100000, B00011000, B00000110, B00000001, B00000000, // /
  4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // 0
  3, 8, B01000010, B01111111, B01000000, B00000000, B00000000, // 1
  4, 8, B01100010, B01010001, B01001001, B01000110, B00000000, // 2
  4, 8, B00100010, B01000001, B01001001, B00110110, B00000000, // 3
  4, 8, B00011000, B00010100, B00010010, B01111111, B00000000, // 4
  4, 8, B00100111, B01000101, B01000101, B00111001, B00000000, // 5
  4, 8, B00111110, B01001001, B01001001, B00110000, B00000000, // 6
  4, 8, B01100001, B00010001, B00001001, B00000111, B00000000, // 7
  4, 8, B00110110, B01001001, B01001001, B00110110, B00000000, // 8
  4, 8, B00000110, B01001001, B01001001, B00111110, B00000000, // 9
  2, 8, B01010000, B00000000, B00000000, B00000000, B00000000, // :
  2, 8, B10000000, B01010000, B00000000, B00000000, B00000000, // ;
  3, 8, B00010000, B00101000, B01000100, B00000000, B00000000, // <
  3, 8, B00010100, B00010100, B00010100, B00000000, B00000000, // =
  3, 8, B01000100, B00101000, B00010000, B00000000, B00000000, // >
  4, 8, B00000010, B01011001, B00001001, B00000110, B00000000, // ?
  5, 8, B00111110, B01001001, B01010101, B01011101, B00001110, // @
  4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A
  4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B
  4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C
  4, 8, B01111111, B01000001, B01000001, B00111110, B00000000, // D
  4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E
  4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F
  4, 8, B00111110, B01000001, B01001001, B01111010, B00000000, // G
  4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H
  3, 8, B01000001, B01111111, B01000001, B00000000, B00000000, // I
  4, 8, B00110000, B01000000, B01000001, B00111111, B00000000, // J
  4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // K
  4, 8, B01111111, B01000000, B01000000, B01000000, B00000000, // L
  5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M
  5, 8, B01111111, B00000100, B00001000, B00010000, B01111111, // N
  4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O
  4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P
  4, 8, B00111110, B01000001, B01000001, B10111110, B00000000, // Q
  4, 8, B01111111, B00001001, B00001001, B01110110, B00000000, // R
  4, 8, B01000110, B01001001, B01001001, B00110010, B00000000, // S
  5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T
  4, 8, B00111111, B01000000, B01000000, B00111111, B00000000, // U
  5, 8, B00001111, B00110000, B01000000, B00110000, B00001111, // V
  5, 8, B00111111, B01000000, B00111000, B01000000, B00111111, // W
  5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X
  5, 8, B00000111, B00001000, B01110000, B00001000, B00000111, // Y
  4, 8, B01100001, B01010001, B01001001, B01000111, B00000000, // Z
  2, 8, B01111111, B01000001, B00000000, B00000000, B00000000, // [
  4, 8, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash
  2, 8, B01000001, B01111111, B00000000, B00000000, B00000000, // ]
  3, 8, B00000010, B00000001, B00000010, B00000000, B00000000, // hat
  4, 8, B01000000, B01000000, B01000000, B01000000, B00000000, // _
  2, 8, B00000001, B00000010, B00000000, B00000000, B00000000, // `
  4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a
  4, 8, B01111111, B01000100, B01000100, B00111000, B00000000, // b
  4, 8, B00111000, B01000100, B01000100, B00101000, B00000000, // c
  4, 8, B00111000, B01000100, B01000100, B01111111, B00000000, // d
  4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e
  3, 8, B00000100, B01111110, B00000101, B00000000, B00000000, // f
  4, 8, B10011000, B10100100, B10100100, B01111000, B00000000, // g
  4, 8, B01111111, B00000100, B00000100, B01111000, B00000000, // h
  3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i
  4, 8, B01000000, B10000000, B10000100, B01111101, B00000000, // j
  4, 8, B01111111, B00010000, B00101000, B01000100, B00000000, // k
  3, 8, B01000001, B01111111, B01000000, B00000000, B00000000, // l
  5, 8, B01111100, B00000100, B01111100, B00000100, B01111000, // m
  4, 8, B01111100, B00000100, B00000100, B01111000, B00000000, // n
  4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // o
  4, 8, B11111100, B00100100, B00100100, B00011000, B00000000, // p
  4, 8, B00011000, B00100100, B00100100, B11111100, B00000000, // q
  4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r
  4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s
  3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t
  4, 8, B00111100, B01000000, B01000000, B01111100, B00000000, // u
  5, 8, B00011100, B00100000, B01000000, B00100000, B00011100, // v
  5, 8, B00111100, B01000000, B00111100, B01000000, B00111100, // w
  5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x
  4, 8, B10011100, B10100000, B10100000, B01111100, B00000000, // y
  3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z
  3, 8, B00001000, B00110110, B01000001, B00000000, B00000000, // {
  1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // |
  3, 8, B01000001, B00110110, B00001000, B00000000, B00000000, // }
  4, 8, B00001000, B00000100, B00001000, B00000100, B00000000, // ~
};

int data = 8;    // DIN pin of MAX7219 module
int load = 9;    // CS pin of MAX7219 module
int clock = 10;  // CLK pin of MAX7219 module

int maxInUse = 4;  //how many MAX7219 are connected

MaxMatrix m(data, load, clock, maxInUse); // define Library

byte buffer[10];

char string1[] = " How do I adjust code to rotate text 90 or 270 deg in this setup?      ";  // Scrolling Text

void setup() {
  m.init(); // module MAX7219
  m.setIntensity(1); // LED Intensity 0-15
}

void loop() {

  byte c;
  delay(100);
  m.shiftLeft(false, true);
  printStringWithShift(string1, 100);  // Send scrolling Text

}

// Put extracted character on Display
void printCharWithShift(char c, int shift_speed) {
  if (c < 32) return;
  c -= 32;
  memcpy_P(buffer, CH + 7 * c, 7);
  m.writeSprite(maxInUse * 8, 0, buffer);
  m.setColumn(maxInUse * 8 + buffer[0], 0);

  for (int i = 0; i < buffer[0] + 1; i++)
  {
    delay(shift_speed);
    m.shiftLeft(false, false);
  }
}

// Extract characters from Scrolling text
void printStringWithShift(char* s, int shift_speed) {
  while (*s != 0) {
    printCharWithShift(*s, shift_speed);
    s++;
  }
}

marco_c:
It is easier if you post code in this forum. Please use code tags </>.
See the links in my signature block

What do you mean your signature block?

This is the module I have

What do you mean your signature block?

The bit at the bottom of my post with the url links.
EDIT: You may have turned this off in your forum profile setup. "Don't show users' signatures" should be unchecked in the layout options.

Yeah found it thanks

I have been having a play around with the links fro marco_c’s links (thanks) and come up with a few problems where my 4 matrix seem to be not in the correct order but as you will see by previous attached image it is all one unit and I can’t move them around, so will you please have a look at this video?

https://1drv.ms/v/s!AkXIJZ58utr9j7phlodTJZ4uku6hng

Sorry it was too large to add as attachment, it is to go with this code

// Use the MD_MAX72XX library to display a Pacman animation
// Just for fun!

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

#define	DEBUG	0		// Enable or disable (default) debugging output

#if DEBUG
#define	PRINT(s, v)		{ Serial.print(F(s)); Serial.print(v); }		  // Print a string followed by a value (decimal)
#define	PRINTX(s, v)	{ Serial.print(F(s)); Serial.print(v, HEX); }	// Print a string followed by a value (hex)
#define	PRINTB(s, v)	{ Serial.print(F(s)); Serial.print(v, BIN); }	// Print a string followed by a value (binary)
#define PRINTC(s, v)  { Serial.print(F(s)); Serial.print((char)v); }	// Print a string followed by a value (char)
#define	PRINTS(s)		  { Serial.print(F(s)); }							          // Print a string
#else
#define	PRINT(s, v)		// Print a string followed by a value (decimal)
#define	PRINTX(s, v)	// Print a string followed by a value (hex)
#define	PRINTB(s, v)	// Print a string followed by a value (binary)
#define PRINTC(s, v)  // Print a string followed by a value (char)
#define	PRINTS(s)		  // Print a string
#endif

// --------------------
// MD_MAX72xx hardware definitions and object
// 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	MAX_DEVICES	4
#define	CLK_PIN		13  // or SCK
#define	DATA_PIN	11  // or MOSI
#define	CS_PIN		10  // or SS

MD_MAX72XX mx = MD_MAX72XX(CS_PIN, MAX_DEVICES);                      // SPI hardware interface
//MD_MAX72XX mx = MD_MAX72XX(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES); // Arbitrary pins

// --------------------
// Constant parameters
//
#define ANIMATION_DELAY 750	// milliseconds   
#define MAX_FRAMES      4   // number of animation frames

// ========== General Variables ===========
//
const uint8_t pacman[MAX_FRAMES][18] =  // ghost pursued by a pacman
{
  { 0xfe, 0x73, 0xfb, 0x7f, 0xf3, 0x7b, 0xfe, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0x7e, 0xff, 0xe7, 0xc3, 0x81, 0x00 },
  { 0xfe, 0x7b, 0xf3, 0x7f, 0xfb, 0x73, 0xfe, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xe7, 0xe7, 0x42, 0x00 },
  { 0xfe, 0x73, 0xfb, 0x7f, 0xf3, 0x7b, 0xfe, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xe7, 0x66, 0x24 },
  { 0xfe, 0x7b, 0xf3, 0x7f, 0xf3, 0x7b, 0xfe, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xff, 0x7e, 0x3c },
};
const uint8_t DATA_WIDTH = (sizeof(pacman[0])/sizeof(pacman[0][0]));

uint32_t prevTimeAnim = 0;  // remember the millis() value in animations
int16_t idx;                // display index (column)
uint8_t frame;              // current animation frame
uint8_t deltaFrame;         // the animation frame offset for the next frame

// ========== Control routines ===========
//
void resetMatrix(void)
{
  mx.control(MD_MAX72XX::INTENSITY, MAX_INTENSITY/2);
  mx.control(MD_MAX72XX::UPDATE, MD_MAX72XX::ON);
  mx.clear();
}

void setup()
{
  mx.begin();
  resetMatrix();
  prevTimeAnim = millis();
  #if DEBUG
  Serial.begin(57600);
  #endif
  PRINTS("\n[MD_MAX72XX Pacman]");
}

void loop(void)
{
  static boolean bInit = true;  // initialise the animation
  
  // Is it time to animate?
  if (millis()-prevTimeAnim < ANIMATION_DELAY)
    return;
  prevTimeAnim = millis();			// starting point for next time

  mx.control(MD_MAX72XX::UPDATE, MD_MAX72XX::OFF);
  
  // Initialise
  if (bInit)
  {
    mx.clear();
    idx = -DATA_WIDTH;
    frame = 0;
    deltaFrame = 1;
    bInit = false;
    
    // Lay out the dots
    for (uint8_t i=0; i<MAX_DEVICES; i++)
    {
      mx.setPoint(3, (i*COL_SIZE) + 3, true);
      mx.setPoint(4, (i*COL_SIZE) + 3, true);
      mx.setPoint(3, (i*COL_SIZE) + 4, true);
      mx.setPoint(4, (i*COL_SIZE) + 4, true);
    }
  }

  // now run the animation
  PRINT("\nINV I:", idx);
  PRINT(" frame ", frame);

  // clear old graphic
  for (uint8_t i=0; i<DATA_WIDTH; i++)
    mx.setColumn(idx-DATA_WIDTH+i, 0);
  // move reference column and draw new graphic
  idx++;
  for (uint8_t i=0; i<DATA_WIDTH; i++)
    mx.setColumn(idx-DATA_WIDTH+i, pacman[frame][i]);

  // advance the animation frame
  frame += deltaFrame;
  if (frame == 0 || frame == MAX_FRAMES-1) 
    deltaFrame = -deltaFrame;

  // check if we are completed and set initialise for next time around
  bInit = (idx == mx.getColumnCount()+DATA_WIDTH);
  
  mx.control(MD_MAX72XX::UPDATE, MD_MAX72XX::ON);

  return;
}

The input connection is going into the right hand side of the module

Also I used this code

// Program to exercise the MD_MAX72XX library
//
// Test the library transformation functions with range subsets

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

// We always wait abit between updates of the display
#define  DELAYTIME  3000  // in milliseconds

// 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	MAX_DEVICES		4	// 2, 4, 6, or 8 work best - see Z array

#define	CLK_PIN		13  // or SCK
#define	DATA_PIN	11  // or MOSI
#define	CS_PIN		10  // or SS

// SPI hardware interface
MD_MAX72XX mx = MD_MAX72XX(CS_PIN, MAX_DEVICES);
// Arbitrary pins
//MD_MAX72XX mx = MD_MAX72XX(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

// Global variables
uint32_t	lastTime = 0;

typedef struct
{
  uint8_t	startDev;	// start of zone
  uint8_t	endDev;		// end of zone
  uint8_t	ch;		// character to show
  MD_MAX72XX::transformType_t	tt;
} zoneDef_t;

zoneDef_t Z[] = 
{
#if MAX_DEVICES == 2
  {0, 0, 26, MD_MAX72XX::TSR  },
  {1, 1, 27, MD_MAX72XX::TSL  },
#endif // MAX_DEVICES 2
#if MAX_DEVICES == 4
  {0, 0, 26, MD_MAX72XX::TSR  },
  {1, 1, 25, MD_MAX72XX::TSD  },
  {2, 2, 24, MD_MAX72XX::TSU  },
  {3, 3, 27, MD_MAX72XX::TSL  },
#endif // MAX_DEVICES 4
#if MAX_DEVICES == 6
  {0, 1, 26, MD_MAX72XX::TSR  },
  {2, 2, 24, MD_MAX72XX::TSU  },
  {3, 3, 25, MD_MAX72XX::TSD  },
  {4, 5, 27, MD_MAX72XX::TSL  },
#endif // MAX_DEVICES 6
#if MAX_DEVICES == 8
  {0, 1, 26, MD_MAX72XX::TSR  },
  {2, 2, 24, MD_MAX72XX::TSU  },
  {3, 3, 25, MD_MAX72XX::TSD  },
  {4, 4, 24, MD_MAX72XX::TSU  },
  {5, 5, 25, MD_MAX72XX::TSD  },
  {6, 7, 27, MD_MAX72XX::TSL  },
#endif // MAX_DEVICES 8
};

#define	ARRAY_SIZE(A)	(sizeof(A)/sizeof(A[0]))

void runTransformation(void) 
{
  mx.control(MD_MAX72XX::UPDATE, MD_MAX72XX::OFF);

  for (uint8_t i = 0; i < ARRAY_SIZE(Z); i++)
    mx.transform(Z[i].startDev, Z[i].endDev, Z[i].tt);

  mx.control(MD_MAX72XX::UPDATE, MD_MAX72XX::ON);
}

void setup()
{
  Serial.begin(57600);
  Serial.println("[Zone Transform Test]");

  mx.begin();
  mx.control(MD_MAX72XX::WRAPAROUND, MD_MAX72XX::ON);

  // set up the display characters
  for (uint8_t i = 0; i < ARRAY_SIZE(Z); i ++)
  {
    mx.clear(Z[i].startDev, Z[i].endDev);
    for (uint8_t j = Z[i].startDev; j <= Z[i].endDev; j++)
      mx.setChar(((j+1)*COL_SIZE)-2, Z[i].ch);
  }
  lastTime = millis();

  // Enable the display
  mx.control(MD_MAX72XX::UPDATE, MD_MAX72XX::ON);
}

void loop() 
{
  if (millis() - lastTime >= DELAYTIME)
  {
    runTransformation();
    lastTime = millis();
  }
}

For the attached arrows picture but this time the input is going into the left hand side. Thank you again for all the help so far!!

The input always goes in the right hand side of the chain of modules. Yours just happen to be all permanently connected. Assuming that they are not wired in different directions, then one of the settings will probably work. You will not break anything if it is wrong, the text/ display will just be wrong aligned. What settings have you tried so far?

marco_c:
What settings have you tried so far?

Sorry what do you mean by what settings? Where do I change them? As the only thing that I have tried is the two codes listed above and as you mentioned the 4 are permanently connected with one input set of pins and one output set of pins.