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
- The library cannot be used (I tried using the library, but it did not work)
- I need to use color depth, but I don’t know how to do it.
- 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;
}
}
}
}