Skip to content

Instantly share code, notes, and snippets.

@maxpromer
Created March 19, 2025 12:11
Show Gist options
  • Save maxpromer/6452cc47b825eb5e87582a5c99e891ae to your computer and use it in GitHub Desktop.
Save maxpromer/6452cc47b825eb5e87582a5c99e891ae to your computer and use it in GitHub Desktop.
P10 RGB Dot Matrix 32x64 Test Code
#include <Arduino.h>
#include <Adafruit_GFX.h>
#include <Adafruit_Protomatter.h>
// Matrix Pin Configs
uint8_t rgbPins[] = { 42, 41, 40, 39, 38, 37 };
uint8_t addrPins[] = { 36, 35, 46, 48 };
uint8_t clockPin = 47;
uint8_t latchPin = 21;
uint8_t oePin = 2;
Adafruit_Protomatter matrix(
32, // Width of matrix (or matrix chain) in pixels
4, // Bit depth, 1-6
1, rgbPins, // # of matrix chains, array of 6 RGB pins for each
4, addrPins, // # of address pins (height is inferred), array of pins
clockPin, latchPin, oePin, // Other matrix control pins
false); // No double-buffering here (see "doublebuffer" example)
uint32_t Wheel(byte WheelPos);
void setup() {
Serial.begin(115200);
ProtomatterStatus status = matrix.begin();
Serial.print("Protomatter begin() status: ");
Serial.println((int)status);
if (status != PROTOMATTER_OK) {
// DO NOT CONTINUE if matrix setup encountered an error.
for (;;)
;
}
// 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();
}
matrix.show();
}
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