#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
// Matrix configuration
#define PANEL_RES_X 64 // Number of pixels wide of each INDIVIDUAL panel module.
#define PANEL_RES_Y 64 // Number of pixels tall of each INDIVIDUAL panel module.
#define PANEL_CHAIN 2 // Total number of panels chained together
MatrixPanel_I2S_DMA *dma_display = nullptr;
void setup() {
Serial.begin(115200);
// Configure HUB75
HUB75_I2S_CFG mxconfig(
PANEL_RES_X, // module width
PANEL_RES_Y, // module height
PANEL_CHAIN // chain length
);
// Set the E-pin (needed for 64x64 panels)
// According to Clockwise project, default E_pin is 18
mxconfig.gpio.e = 18;
// Use standard pins for the rest (unless your hardware is different):
/*
mxconfig.gpio.r1 = 25;
mxconfig.gpio.g1 = 26;
mxconfig.gpio.b1 = 27;
mxconfig.gpio.r2 = 14;
mxconfig.gpio.g2 = 12;
mxconfig.gpio.b2 = 13;
mxconfig.gpio.a = 23;
mxconfig.gpio.b = 19;
mxconfig.gpio.c = 5;
mxconfig.gpio.d = 17;
mxconfig.gpio.lat = 4;
mxconfig.gpio.oe = 15;
mxconfig.gpio.clk = 16;
*/
// Optional: If colors are swapped, you can adjust pins here
// mxconfig.gpio.b1 = 26; // example swap
// Initialize display
dma_display = new MatrixPanel_I2S_DMA(mxconfig);
dma_display->begin();
dma_display->setBrightness8(64); // 0-255
dma_display->clearScreen();
Serial.println("Display initialized. Starting color test...");
}
void loop() {
// 1. Fill Red
Serial.println("Filling Red...");
dma_display->fillScreen(dma_display->color565(255, 0, 0));
delay(2000);
// 2. Fill Green
Serial.println("Filling Green...");
dma_display->fillScreen(dma_display->color565(0, 255, 0));
delay(2000);
// 3. Fill Blue
Serial.println("Filling Blue...");
dma_display->fillScreen(dma_display->color565(0, 0, 255));
delay(2000);
// 4. Fill White (All LEDs on)
Serial.println("Filling White (Full Power Test)...");
dma_display->fillScreen(dma_display->color565(255, 255, 255));
delay(2000);
// 5. Clear Screen
dma_display->clearScreen();
delay(1000);
}