Je fais appel à vous car je suis actuellement en galère avec un panneau LED. Je m'explique : j'ai un panneau LED P3 64x64 que je souhaiterai contrôler.
Problème, je ne sais pas exactement comment il fonctionne. J'ai réussi à grappiller quelques tutos à droite à gauche, mais les résultats ne sont pas concluants...
J'avais réussi à trouver le programme suivant :
#include <DFRobot_RGBMatrix.h> // Hardware-specific library
#include <Wire.h>
#define OE 9
#define LAT 10
#define CLK 11
#define A A0
#define B A1
#define C A2
#define D A3
#define E A4
#define WIDTH 64
#define HIGH 64
int a=0;
int b=16;
DFRobot_RGBMatrix matrix(A, B, C, D, E, CLK, LAT, OE, false, WIDTH, HIGH);
void setup()
{
matrix.begin();
// fill the screen with 'black'
matrix.setTextSize(1); // size 1 == 8 pixels high
matrix.fillScreen(matrix.Color333(0, 0, 0));
delay(500);
}
void loop(){
byte i;
if(a<=-64) {
a=64;
}
if(b<=-48) {
b=80;
}
matrix.fillScreen(0);//clear the screen
matrix.setTextSize(2);//Set as 16*16 pixel
matrix.setCursor(15, a); // start at top left, with 8 pixel of spacing
matrix.setTextColor(matrix.Color333(4, 0, 4));//
matrix.println("DFR");//
matrix.setTextSize(1);//Set as 8*8 pixel
matrix.setCursor(12, b);
matrix.println("DFROBOT");
matrix.setTextSize(1);
matrix.print("Let's joinhands witheach otherto create a future");
delay(600);
a=a-6;
b=b-6;
}
Au départ il a "allumé" mon panneau led mais pas du tout comme le programme le demandait (cf photo).
Et maintenant c'est encore plus curieux car le programme ne compile plus du tout et l'IDE affiche un long et effrayant message d'erreur.
Merci d'éditer votre post pour rajouter les balises de de code, c'est illisible tel quel:
sélectionner la partie du texte qui correspond au code
appuyez sur l'icône </> dans la barre d'outils pour indiquer que c'est du code
(Assurez vous aussi d'indenter le code correctement dans l'IDE avant de le copier pour le coller ici. Cela se fait en pressant ctrlT sur PC ou cmdT sur un Mac)
le message d'erreur, c'est du texte, vaudrait mieux le poster en tant que tel..
pas sûr que ce soit prévu pour fonctionner sur un UNO... Quelle bibliothèque utilisez vous ?
In file included from C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master/DFRobot_RGBMatrix.h:16:0,
from C:\Users\thoma\AppData\Local\Temp\arduino_modified_sketch_957546\sketch_may18a.ino:2:
C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master/Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp] #warning "The SD library was not found. loadImage() and image() won't be supported."
^~~~~~~
C:\Users\thoma\AppData\Local\Temp\arduino_modified_sketch_957546\sketch_may18a.ino:13:0: warning: "HIGH" redefined #define HIGH 64
In file included from sketch\sketch_may18a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.49.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:40:0: note: this is the location of the previous definition #define HIGH 0x1
In file included from C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master/DFRobot_RGBMatrix.h:16:0,
from C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master\DFRobot_RGBMatrix.cpp:28:
C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master/Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp] #warning "The SD library was not found. loadImage() and image() won't be supported."
^~~~~~~
In file included from C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master\Adafruit_GFX.cpp:34:0:
C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master\Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp] #warning "The SD library was not found. loadImage() and image() won't be supported."
^~~~~~~
C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master\DFRobot_RGBMatrix.cpp: In member function 'void DFRobot_RGBMatrix::FM6126_Init()':
C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master\DFRobot_RGBMatrix.cpp:133:38: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Write_REG1(24,25,26,27,28,29,0xFFC2);
^
C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master\DFRobot_RGBMatrix.cpp:134:38: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Write_REG2(24,25,26,27,28,29,0x6862);
^
In file included from C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master\RGBmatrixPanel.h:7:0,
from C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master\RGBmatrixPanel.cpp:36:
C:\Users\thoma\Documents\Arduino\libraries\DFRobot_RGBMatrix-master\Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp] #warning "The SD library was not found. loadImage() and image() won't be supported."
^~~~~~~
libraries\DFRobot_RGBMatrix-master\RGBmatrixPanel.cpp.o (symbol from plugin): In function RGBmatrixPanel::drawPixel(int, int, unsigned int)': (.text+0x0): multiple definition of __vector_13'
libraries\DFRobot_RGBMatrix-master\DFRobot_RGBMatrix.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Erreur de compilation pour la carte Arduino Uno
pour le produit associé à la bibliothèque (je ne suis pas sûr que votre produit soit le même) ils disent dans la doc
It requires at least 13 digital GPIOs to control the LED matrix. So the UNO board won’t be a good choice in this application, recommended Mega 2560, Raspberry Pi and the other kinds of microcontroller with large RAM and high speed
width c'est la largeur de l'écran donc 64
nRows c'est la hauteur de l'écran divisée par 2 donc 32
ce qui donne un buffer de 64 x 32 x 3 = 6144 octets
Donc on dépasse déjà la taille mémoire du processeur.
Ça passera tout juste sur une mega2560 si tu n'utilises pas d'autres librairies trop gourmandes en ressource mémoire.
En tous cas en ayant installé DFRobot_RGBMatrix ce code compile parfaitement.
La remarque de fdufnews est à prendre en compte. Le buffer de l'écran est alloué dynamiquement dans la librairie. 6K, aucune chance avec une UNO.
Avec une MEGA et ses 8Ko de RAM, il ne faudra pas être non plus trop gourmand et ajouter des librairies consommant beaucoup de RAM.