So I recently purchased the Adafruit 32x64 RGB Matrix, and I’ve been able to successfully (kinda) light it up and interact with it.
The problem I am facing though is with the graphics library and setting up the library so it understands that my board is 32x64 and not 32x32.
The code I am using can be seen below.
#include "Adafruit_GFX.h" // Core graphics library
#include "RGBmatrixPanel.h" // Hardware-specific library
#include "math.h" // Math library
#define pgm_read_byte_near(_addr) (pgm_read_byte(_addr))
#define pgm_read_byte_far(_addr) (pgm_read_byte(_addr))
#define pgm_read_word(_addr) (*(const uint16_t *)(_addr))
#define pgm_read_word_near(_addr) (pgm_read_word(_addr))
#define RGBPCversion "V1.03g"
#define PI 3.1415926539
#define CLK D6
#define OE D7
#define LAT A4
#define A A0
#define B A1
#define C A2
#define D A3
char publishString[40];
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false);
SYSTEM_MODE(SEMI_AUTOMATIC);
void setup()
{
Particle.connect();
while (!Particle.connected())
{
Particle.process();
}
Particle.publish("RGBPongClock", RGBPCversion, 60, PRIVATE);
Particle.process();
matrix.begin();
matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
delay(500);
matrix.fillRect(0, 0, matrix.width(), matrix.height(), matrix.Color333(0, 7, 0));
delay(500);
matrix.drawRect(0, 0, matrix.width(), matrix.height(), matrix.Color333(7, 7, 0));
delay(500);
matrix.drawLine(0, 0, matrix.width()-1, matrix.height()-1, matrix.Color333(7, 0, 0));
matrix.drawLine(matrix.width()-1, 0, 0, matrix.height()-1, matrix.Color333(7, 0, 0));
delay(500);
matrix.drawCircle(10, 10, 10, matrix.Color333(0, 0, 7));
delay(500);
matrix.fillCircle(40, 21, 10, matrix.Color333(7, 0, 7));
delay(500);
matrix.fillScreen(matrix.Color333(0, 0, 0));
matrix.setTextSize(1);
matrix.setTextWrap(false);
matrix.setCursor(8, 0);
uint8_t w = 0;
char *str = "AdafruitIndustries";
for(w = 0; w < 8; w++)
{
matrix.setTextColor(Wheel(w));
matrix.print(str[w]);
}
matrix.setCursor(2, 8);
for(w = 8; w < 18; w++)
{
matrix.setTextColor(Wheel(w));
matrix.print(str[w]);
}
matrix.println();
matrix.setTextColor(matrix.Color333(7, 7, 7));
matrix.println("LED MATRIX!");
matrix.setTextColor(matrix.Color333(7, 0, 0));
matrix.print('3');
matrix.setTextColor(matrix.Color333(7, 4, 0));
matrix.print('2');
matrix.setTextColor(matrix.Color333(7, 7, 0));
matrix.print('x');
matrix.setTextColor(matrix.Color333(4, 7, 0));
matrix.print('6');
matrix.setTextColor(matrix.Color333(0, 7, 0));
matrix.print('4');
matrix.setCursor(34, 24);
matrix.setTextColor(matrix.Color333(0, 7, 7));
matrix.print("*");
matrix.setTextColor(matrix.Color333(0, 4, 7));
matrix.print('R');
matrix.setTextColor(matrix.Color333(0, 0, 7));
matrix.print('G');
matrix.setTextColor(matrix.Color333(4, 0, 7));
matrix.print("B");
matrix.setTextColor(matrix.Color333(7, 0, 4));
matrix.println("*");
}
void loop()
{
}
uint16_t Wheel(byte WheelPos)
{
if(WheelPos < 8)
{
return matrix.Color333(7 - WheelPos, WheelPos, 0);
}
else if(WheelPos < 16)
{
WheelPos -= 8;
return matrix.Color333(0, 7 - WheelPos, WheelPos);
}
else
{
WheelPos -= 16;
return matrix.Color333(0, WheelPos, 7 - WheelPos);
}
}
The two libraries at the top can be found here, and here.
With the code above, my board should look exactly like this.
In the RGBmatrixPanel.cpp file, there’s a section for numPanels
, which by default is set to 1
.
When I leave this set as the default, my matrix board looks like the following.
So naturally, I assume I need to change numPanels
from 1
to 2
.
When I do that, you can see what the board looks like.
I’ve tried everything I could think of, and now I’m asking the community for their input.
Thanks guys!