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.
#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);
}
Firstly thanks for trying to help me with project
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 . I attache the photo of the result.
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.
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.
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?