Last active
March 19, 2025 12:36
-
-
Save maxpromer/6b014c928e152eb56202a971f52d1533 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h> | |
#define PANEL_RES_X 32 // Number of pixels wide of each INDIVIDUAL panel module. | |
#define PANEL_RES_Y 16 // Number of pixels tall of each INDIVIDUAL panel module. | |
#define PANEL_CHAIN 1 // Total number of panels chained one to another | |
// Module configuration | |
HUB75_I2S_CFG mxconfig( | |
PANEL_RES_X, // module width | |
PANEL_RES_Y, // module height | |
PANEL_CHAIN // Chain length | |
); | |
// Display Setup | |
MatrixPanel_I2S_DMA matrix(mxconfig); | |
uint32_t Wheel(byte WheelPos); | |
void setup() { | |
Serial.begin(115200); | |
matrix.begin(); | |
// fill the screen with 'black' | |
matrix.fillScreen(matrix.color565(0, 0, 0)); | |
{ | |
matrix.setCursor(7, 0); | |
const char* str = "P10"; | |
for (uint8_t i = 0; i < strlen(str); i++) { | |
matrix.setTextColor(Wheel(i * 20)); | |
matrix.print(str[i]); | |
} | |
matrix.println(); | |
} | |
{ | |
matrix.setCursor(1, 6 + 2); | |
const char* str = "32x16"; | |
for (uint8_t i = 0; i < strlen(str); i++) { | |
matrix.setTextColor(Wheel(200 + (i * 20))); | |
matrix.print(str[i]); | |
} | |
matrix.println(); | |
} | |
} | |
void loop() { | |
// do nothing | |
} | |
uint32_t Wheel(byte WheelPos) { | |
WheelPos = 255 - WheelPos; | |
if (WheelPos < 85) { | |
return matrix.color565(255 - WheelPos * 3, 0, WheelPos * 3); | |
} | |
if (WheelPos < 170) { | |
WheelPos -= 85; | |
return matrix.color565(0, WheelPos * 3, 255 - WheelPos * 3); | |
} | |
WheelPos -= 170; | |
return matrix.color565(WheelPos * 3, 255 - WheelPos * 3, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment