Cascade connected 16x32 rgb matrix. Problem with too little buffer to letters

I'm making project with my friend during my studies, which is called little advertisement. We have a huge problem with buffer, which is too small and letters are overlapping each other when string size is bigger than 21 letters. I ask you for help with making the buffer bigger or if you know another way than can help with my problem I will be grateful. Thanks for any reply. I attach code and photo of the result.

ORGINAL1.2.ino (2.11 KB)

Can you post your code as described in the forum guide please? I can't open a .ino attachment on my phone.

#include <Adafruit_GFX.h>   // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library
//-----------------------------------------------------------
#define CLK 11  // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT 10
#define OE  9
#define A   A0
#define B   A1
#define C   A2
#define n   4  // Number of inline panels
// Last parameter = 'true' enables double-buffering, for flicker-free,
// buttery smooth animation.  Note that NOTHING WILL SHOW ON THE DISPLAY
// until the first call to swapBuffers().  This is normal.
//------------------------------------------------------------
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false, 32*n);
// Double-buffered mode consumes nearly all the RAM available on the
// Arduino Uno -- only a handful of free bytes remain.  Even the
// following string needs to go in PROGMEM:
//-----------------------------------------------------------
String str ="Witamy w PWSZ Gniezno";
int scroll=20;

int a=12;
int dl;
int d;
int kolor=1;
void setup() {
  matrix.begin();
}

void loop() {
    dl = str.length();
    matrix.fillScreen(0);
    matrix.setTextSize(2);     // size 1 == 8 pixels high
    matrix.swapBuffers(true);
  for(int i=6;;i--){
    matrix.setCursor(i, 1);    // start at top left, with one pixel of spacing
      matrix.fillScreen(0);
      switch(kolor){
      case 1:
      matrix.setTextColor(matrix.Color333(6,7,3));
      break;
      case 3:
      matrix.setTextColor(matrix.Color333(2,0,6));
      break;
      case 5:
      matrix.setTextColor(matrix.Color333(2,3,0));
      break;
      case 7:
      matrix.setTextColor(matrix.Color333(4,2,3));
      break;
      case 9:
      matrix.setTextColor(matrix.Color333(5,3,2));
      break;
      case 11:
      matrix.setTextColor(matrix.Color333(3,2,0));
      break;
      case 13:
      matrix.setTextColor(matrix.Color333(3,3,3));
      break;
      case 15:
      matrix.setTextColor(matrix.Color333(3,6,2));
      break;
      case 17:
      matrix.setTextColor(matrix.Color333(7,3,1));
      break;
      case 19:
      matrix.setTextColor(matrix.Color333(2,7,3));
      break;
      }
      kolor++;
      if(kolor==20)kolor=0;
      
      
     for(d=0;d<dl;d++){
      matrix.setCursor(i+((d+1)*12), 1);
      matrix.print(str[d]);
      
    }
    matrix.swapBuffers(true);
  }
  delay(scroll); 
}

Thanks. What kind of Arduino are you using? Mega?

I am not certain that this line is correct:

      matrix.print(str[d]);

The method of accessing a certain character in the string works for character arrays, but maybe not for String class. You could try

      matrix.print(str.charAt(d));

Firstly thanks for trying to help me with project :slight_smile:
Yes I'm using Arduino Mega.
Unfortunately, the problem is still alive. I think the problem can be in hardware library. I tried to make some changes but it only getting worse and worse . :frowning: I attache the photo of the result.

Here are the constructors for the class:

// Constructor for 16x32 panel:
  RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c,
    uint8_t clk, uint8_t lat, uint8_t oe, boolean dbuf
#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP32)
    ,uint8_t *pinlist=NULL
#endif
    );

  // Constructor for 32x32 panel (adds 'd' pin):
  RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c, uint8_t d,
    uint8_t clk, uint8_t lat, uint8_t oe, boolean dbuf, uint8_t width=32
#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP32)
    ,uint8_t *pinlist=NULL
#endif
    );

The constructor for 16x32 panels does not seem to accept a parameter for the width. The constructor for 32x32 panels does have a width parameter.

EDIT: the above is from the AdaFruit library.

Which version of the library are you using? Did you install from library manager or from zip file?

Looks like this fork of the library allows the width parameter for 16x32 panels.

There is the link to GitHub which i downloaded library. I installed it from zip file. I was searching a long time for it.

Raizer68:
There is the link to GitHub which i downloaded library. I installed it from zip file.

Yes, that is the library where the 16x32 constructor does not have the width parameter. Try the other library I found. You will need to delete the AdaFruit library folder from your libraries folder, then install the other version from the zip file.

AdaFruit or RGB-matrix-Panel-master library I should delete? I think RGB

Yes, RGB-matrix-Panel.

I got than report
Arduino:1.8.8 (Mac OS X), Płytka:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from /Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp:29:0:
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/gamma.h:6:16: error: 'prog_uchar' does not name a type
static PROGMEM prog_uchar gamma[] = {
^
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:28:0,
from /Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.h:2,
from /Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp:28:
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp: In member function 'uint16_t RGBmatrixPanel::Color888(uint8_t, uint8_t, uint8_t, boolean)':
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp:217:24: error: 'gamma' was not declared in this scope
r = pgm_read_byte(&gamma[r]); // Gamma correction table maps
^
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp:218:24: error: 'gamma' was not declared in this scope
g = pgm_read_byte(&gamma[g]); // 8-bit input to 4-bit output
^
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp:219:24: error: 'gamma' was not declared in this scope
b = pgm_read_byte(&gamma**);**
** ^**
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp: In member function 'uint16_t RGBmatrixPanel::ColorHSV(long int, uint8_t, uint8_t, boolean)':
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp:258:24: error: 'gamma' was not declared in this scope
r = pgm_read_byte(&gamma[(r * v1) >> 8]); // Gamma correction table maps
** ^**
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp:259:24: error: 'gamma' was not declared in this scope
g = pgm_read_byte(&gamma[(g * v1) >> 8]); // 8-bit input to 4-bit output
** ^**
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp:260:24: error: 'gamma' was not declared in this scope
b = pgm_read_byte(&gamma[(b * v1) >> 8]);
** ^**
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp: In member function 'virtual void RGBmatrixPanel::drawPixel(int16_t, int16_t, uint16_t)':
/Users/tomasz/Documents/Arduino/libraries/RGB-matrix-Panel-master/RGBmatrixPanel.cpp:278:14: error: 'swap' was not declared in this scope
** swap(x, y);**
** ^**
exit status 1
Błąd kompilacji dla płytki Arduino/Genuino Mega or Mega 2560.

Hmm...

The library with the width parameter in the 16x32 constructor has not been updated for 5 years. The Adafuit library has been updated a few days ago. This is not going to be easy. I suggest you go back to the Adafruit library and then raise an issue on the GitHub page saying that the 32x32 constructor can accept a width parameter but the 16x32 constructor cannot, and can this please be fixed because you are trying to connect 4 X 16x32 panels. Perhaps Limor will be kind to you. But there is no reason for her to be kind, because I guess you did not buy the panels from Adafruit?

I bought matrixes from botland Thanks for help :slight_smile: I will try :slight_smile:

Raizer68:
I bought matrixes from botland

Yeah... don't mention where you purchased the panels when you raise the issue.