32x32 1/8 scan led matrix 4 connections

hello.
I'm using a translator, so the words and grammar may be strange.
It hasn't been long since I studied the C language.
I was assigned to a project, but it was very difficult.
I need to control a 64x64 matrix by connecting four 32x32 matrices, and the 32x32 1/8scan matrix was successful in creating a QRcode.
The board uses the adafruit matrix portal m4.
But there are still many problems

  1. The library cannot be used (I tried using the library, but it did not work)
  2. I need to use color depth, but I don’t know how to do it.
  3. I don't know how to write code when connecting two or more 32x32 matrices.
    Thank you for your comments.
#define r1 7
#define g1 8
#define b1 9
#define r2 10
#define g2 11
#define b2 12
#define a_pin 17
#define b_pin 18
#define c_pin 19
#define clock_pin 14
#define lat_pin 15
#define oe_pin 16
#include "qrcode.h"
int firstarr[32][32] = {};

void setup() {
  pinMode(r1, OUTPUT);
  pinMode(g1, OUTPUT);
  pinMode(b1, OUTPUT);
  pinMode(r2, OUTPUT);
  pinMode(g2, OUTPUT);
  pinMode(b2, OUTPUT);
  pinMode(a_pin, OUTPUT);
  pinMode(b_pin, OUTPUT);
  pinMode(c_pin, OUTPUT);
  pinMode(clock_pin, OUTPUT);
  pinMode(lat_pin, OUTPUT);
  pinMode(oe_pin, OUTPUT);

  for (int i = 0; i < 32; i++) {
    for (int j = 0; j < 32; j++) {
      firstarr[i][j] = 0;
    }
  }
  qrcode();
}

void loop() {
  scan();
}

void scan() {
  int c;
  for (int row = 0; row < 8; row++) {
    for (int i = 0; i < 64; i++) {
      c = i;
      if (i <= 31) {
        c += 32;
      } else if (i >= 32) {
        c -= 32;
      }
      if (c < 32) {
        digitalWrite(r1, firstarr[row][c] & 1);
        digitalWrite(g1, firstarr[row][c] & 1);
        digitalWrite(b1, firstarr[row][c] & 1);
        digitalWrite(r2, firstarr[row + 16][c] & 1);
        digitalWrite(g2, firstarr[row + 16][c] & 1);
        digitalWrite(b2, firstarr[row + 16][c] & 1);
      } else if (c >= 32) {
        digitalWrite(r1, firstarr[row + 8][c - 32] & 1);
        digitalWrite(g1, firstarr[row + 8][c - 32] & 1);
        digitalWrite(b1, firstarr[row + 8][c - 32] & 1);
        digitalWrite(r2, firstarr[row + 24][c - 32] & 1);
        digitalWrite(g2, firstarr[row + 24][c - 32] & 1);
        digitalWrite(b2, firstarr[row + 24][c - 32] & 1);
      }

      digitalWrite(clock_pin, 1);
      digitalWrite(clock_pin, 0);
    }
    digitalWrite(oe_pin, 1);
    digitalWrite(lat_pin, 1);
    digitalWrite(a_pin, (row & 1) ? 1 : 0);
    digitalWrite(b_pin, (row & 2) ? 1 : 0);
    digitalWrite(c_pin, (row & 4) ? 1 : 0);
    digitalWrite(oe_pin, 0);
    digitalWrite(lat_pin, 0);

  }
}

void qrcode() {
  QRCode qrcode;
  uint8_t qrcodeData[qrcode_getBufferSize(3)];
  qrcode_initText(&qrcode, qrcodeData, 3, 0, "https://www.naver.com/");
  for (uint8_t y = 0; y < qrcode.size; y++) {
    for (uint8_t x = 0; x < qrcode.size; x++) {
      if (qrcode_getModule(&qrcode, y, x)) {
        firstarr[y + 1][x + 1] = 1;
      }
    }
  }
}

What does the output window show for memory usage?

Format your code like this:
(copy/cut your code, click < CODE >, paste code where you see **type or paste code here**)

#define r1 7
#define g1 8
#define b1 9
#define r2 10
#define g2 11
#define b2 12
#define a_pin 17
#define b_pin 18
#define c_pin 19
#define clock_pin 14
#define lat_pin 15
#define oe_pin 16
#include "qrcode.h"
int firstarr[32][32] = {};

void setup() {
  pinMode(r1, OUTPUT);
  pinMode(g1, OUTPUT);
  pinMode(b1, OUTPUT);
  pinMode(r2, OUTPUT);
  pinMode(g2, OUTPUT);
  pinMode(b2, OUTPUT);
  pinMode(a_pin, OUTPUT);
  pinMode(b_pin, OUTPUT);
  pinMode(c_pin, OUTPUT);
  pinMode(clock_pin, OUTPUT);
  pinMode(lat_pin, OUTPUT);
  pinMode(oe_pin, OUTPUT);

  for (int i = 0; i < 32; i++) {
    for (int j = 0; j < 32; j++) {
      firstarr[i][j] = 0;
    }
  }
  qrcode();
}

void loop() {
  scan();
}

void scan() {
  int c;
  for (int row = 0; row < 8; row++) {
    for (int i = 0; i < 64; i++) {
      c = i;
      if (i <= 31) {
        c += 32;
      } else if (i >= 32) {
        c -= 32;
      }
      if (c < 32) {
        digitalWrite(r1, firstarr[row][c] & 1);
        digitalWrite(g1, firstarr[row][c] & 1);
        digitalWrite(b1, firstarr[row][c] & 1);
        digitalWrite(r2, firstarr[row + 16][c] & 1);
        digitalWrite(g2, firstarr[row + 16][c] & 1);
        digitalWrite(b2, firstarr[row + 16][c] & 1);
      } else if (c >= 32) {
        digitalWrite(r1, firstarr[row + 8][c - 32] & 1);
        digitalWrite(g1, firstarr[row + 8][c - 32] & 1);
        digitalWrite(b1, firstarr[row + 8][c - 32] & 1);
        digitalWrite(r2, firstarr[row + 24][c - 32] & 1);
        digitalWrite(g2, firstarr[row + 24][c - 32] & 1);
        digitalWrite(b2, firstarr[row + 24][c - 32] & 1);
      }

      digitalWrite(clock_pin, 1);
      digitalWrite(clock_pin, 0);
    }
    digitalWrite(oe_pin, 1);
    digitalWrite(lat_pin, 1);
    digitalWrite(a_pin, (row & 1) ? 1 : 0);
    digitalWrite(b_pin, (row & 2) ? 1 : 0);
    digitalWrite(c_pin, (row & 4) ? 1 : 0);
    digitalWrite(oe_pin, 0);
    digitalWrite(lat_pin, 0);

  }
}

void qrcode() {
  QRCode qrcode;
  uint8_t qrcodeData[qrcode_getBufferSize(3)];
  qrcode_initText(&qrcode, qrcodeData, 3, 0, "https://www.naver.com/");
  for (uint8_t y = 0; y < qrcode.size; y++) {
    for (uint8_t x = 0; x < qrcode.size; x++) {
      if (qrcode_getModule(&qrcode, y, x)) {
        firstarr[y + 1][x + 1] = 1;
      }
    }
  }
}

Take a look here...

and here...

The sketch uses 15776 bytes (3%) of program storage space. Up to 507904 bytes.
Device       : ATSAMD51x19
Version      : v1.1 [Arduino:XYZ] Sep 13 2020 00:07:13
Address      : 0x0
Pages        : 1024
Page Size    : 512 bytes
Total Size   : 512KB
Planes       : 1
Lock Regions : 32
Locked       : none
Security     : false
BOD          : false
BOR          : true
Write 16032 bytes to flash (32 pages)

[                              ] 0% (0/32 pages)
[=======                       ] 25% (8/32 pages)
[===============               ] 50% (16/32 pages)
[======================        ] 75% (24/32 pages)
[==============================] 100% (32/32 pages)
Done in 0.231 seconds
Verify 16032 bytes of flash

[=                             ] 6% (2/32 pages)
[==                            ] 9% (3/32 pages)
[===                           ] 12% (4/32 pages)
[====                          ] 15% (5/32 pages)
[=====                         ] 18% (6/32 pages)
[======                        ] 21% (7/32 pages)
[=======                       ] 25% (8/32 pages)
[========                      ] 28% (9/32 pages)
[=========                     ] 31% (10/32 pages)
[==========                    ] 34% (11/32 pages)
[===========                   ] 37% (12/32 pages)
[============                  ] 40% (13/32 pages)
[=============                 ] 43% (14/32 pages)
[==============                ] 46% (15/32 pages)
[===============               ] 50% (16/32 pages)
[===============               ] 53% (17/32 pages)
[================              ] 56% (18/32 pages)
[=================             ] 59% (19/32 pages)
[==================            ] 62% (20/32 pages)
[===================           ] 65% (21/32 pages)
[====================          ] 68% (22/32 pages)
[=====================         ] 71% (23/32 pages)
[======================        ] 75% (24/32 pages)
[=======================       ] 78% (25/32 pages)
[========================      ] 81% (26/32 pages)
[=========================     ] 84% (27/32 pages)
[==========================    ] 87% (28/32 pages)
[===========================   ] 90% (29/32 pages)
[============================  ] 93% (30/32 pages)
[============================= ] 96% (31/32 pages)
[==============================] 100% (32/32 pages)
Verify successful
Done in 0.094 seconds

Even after looking at the data you provided, I can't get a feel for it.
First, I increased the i value of the scan function to 128 to create 64x32, but it did not work properly.

The 64x64 links might have libraries that have examples on how to use the 64x64...

The one 64x64 is not the same as four 32x32.
The matrices chained one by one, therefore four 32x32 is 128x32

If I connect two to make it 64x32, which part of my code should I modify?

Then I would set the 32z32 up in zigzag or continuous and try Adafruit_NeoMatrix.

Is Adafruit Neomatrix starts working with DMD RGB panels? The control principles of addressable led matrix (Neonatrix) and HUB75 matrix is rather different

I was assuming Neopixel.

I have an experience with such matrices and I definitely recommend you use the libraries. The protocol for working with RGB HUB75 panels is quite complex and, importantly, requires very fast updating; so there is very little chance that you will write working code for color depth control and using a chain of matrices.

Your problem with the library is most likely explained by the fact that you are using matrices of height 32 with scan 8. Most libraries are designed for matrices with a half-height scan, that is, for trouble-free operation of a 32x32 matrix there must be 16 scans. Or just take one 64x64 32 scan matrix. They are not too expensive and it will definitely be more effective than spending a lot of time on these matrices of yours.

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