Trop compliqué pour moi. Voici ce que j'ai préparé :
#include "FastLED.h"
#define NUM_LEDS 60 // Nombre de LEDs par ligne
#define COLOR_ORDER BRG // Color order
#define NumLignes 8
CRGB ligne0[NUM_LEDS]; // <-- C'est la ligne du haut !
CRGB ligne1[NUM_LEDS];
CRGB ligne2[NUM_LEDS];
CRGB ligne3[NUM_LEDS];
CRGB ligne4[NUM_LEDS];
CRGB ligne5[NUM_LEDS];
CRGB ligne6[NUM_LEDS];
CRGB ligne7[NUM_LEDS]; // Et la ligne du bas
char Message[101] = "Itaque tum Scaevola cum in eam ipsam mentionem incidisset, exposuit nobis sermonem Laeli de amicitia"; // Max 100 caractères à afficher
char Texte[NUM_LEDS]; // Le texte affiché à chaque instant
// On laisse un pixel entre chaque lettre affichée (ça peut être modifié)
#define PIXELS 6 // Nombre de pixels par lettre (yc un espace)
// A priori 7 lignes de LEDs suffisent avec cette définition
const uint8_t Font5x7[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0xfa, 0x00, 0x00, // !
0x00, 0xe0, 0x00, 0xe0, 0x00, // "
0x28, 0xfe, 0x28, 0xfe, 0x28, // #
0x24, 0x54, 0xfe, 0x54, 0x48, // $
0xc4, 0xc8, 0x10, 0x26, 0x46, // %
0x6c, 0x92, 0xaa, 0x44, 0x0a, // &
0x00, 0xa0, 0xc0, 0x00, 0x00, // '
0x00, 0x38, 0x44, 0x82, 0x00, // (
0x00, 0x82, 0x44, 0x38, 0x00, // )
0x10, 0x54, 0x38, 0x54, 0x10, // *
0x10, 0x10, 0x7c, 0x10, 0x10, // +
0x00, 0x0a, 0x0c, 0x00, 0x00, // ,
0x10, 0x10, 0x10, 0x10, 0x10, // -
0x00, 0x06, 0x06, 0x00, 0x00, // .
0x04, 0x08, 0x10, 0x20, 0x40, // /
0x7c, 0x8a, 0x92, 0xa2, 0x7c, // 0
0x00, 0x42, 0xfe, 0x02, 0x00, // 1
0x42, 0x86, 0x8a, 0x92, 0x62, // 2
0x84, 0x82, 0xa2, 0xd2, 0x8c, // 3
0x18, 0x28, 0x48, 0xfe, 0x08, // 4
0xe4, 0xa2, 0xa2, 0xa2, 0x9c, // 5
0x3c, 0x52, 0x92, 0x92, 0x0c, // 6
0x80, 0x8e, 0x90, 0xa0, 0xc0, // 7
0x6c, 0x92, 0x92, 0x92, 0x6c, // 8
0x60, 0x92, 0x92, 0x94, 0x78, // 9
0x00, 0x6c, 0x6c, 0x00, 0x00, // :
0x00, 0x6a, 0x6c, 0x00, 0x00, // ;
0x00, 0x10, 0x28, 0x44, 0x82, // <
0x28, 0x28, 0x28, 0x28, 0x28, // =
0x82, 0x44, 0x28, 0x10, 0x00, // >
0x40, 0x80, 0x8a, 0x90, 0x60, // ?
0x4c, 0x92, 0x9e, 0x82, 0x7c, // @
0x7e, 0x88, 0x88, 0x88, 0x7e, // A
0xfe, 0x92, 0x92, 0x92, 0x6c, // B
0x7c, 0x82, 0x82, 0x82, 0x44, // C
0xfe, 0x82, 0x82, 0x44, 0x38, // D
0xfe, 0x92, 0x92, 0x92, 0x82, // E
0xfe, 0x90, 0x90, 0x80, 0x80, // F
0x7c, 0x82, 0x82, 0x8a, 0x4c, // G
0xfe, 0x10, 0x10, 0x10, 0xfe, // H
0x00, 0x82, 0xfe, 0x82, 0x00, // I
0x04, 0x02, 0x82, 0xfc, 0x80, // J
0xfe, 0x10, 0x28, 0x44, 0x82, // K
0xfe, 0x02, 0x02, 0x02, 0x02, // L
0xfe, 0x40, 0x20, 0x40, 0xfe, // M
0xfe, 0x20, 0x10, 0x08, 0xfe, // N
0x7c, 0x82, 0x82, 0x82, 0x7c, // O
0xfe, 0x90, 0x90, 0x90, 0x60, // P
0x7c, 0x82, 0x8a, 0x84, 0x7a, // Q
0xfe, 0x90, 0x98, 0x94, 0x62, // R
0x62, 0x92, 0x92, 0x92, 0x8c, // S
0x80, 0x80, 0xfe, 0x80, 0x80, // T
0xfc, 0x02, 0x02, 0x02, 0xfc, // U
0xf8, 0x04, 0x02, 0x04, 0xf8, // V
0xfe, 0x04, 0x18, 0x04, 0xfe, // W
0xc6, 0x28, 0x10, 0x28, 0xc6, // X
0xc0, 0x20, 0x1e, 0x20, 0xc0, // Y
0x86, 0x8a, 0x92, 0xa2, 0xc2, // Z
0x00, 0x00, 0xfe, 0x82, 0x82, // [
0x40, 0x20, 0x10, 0x08, 0x04, // (backslash)
0x82, 0x82, 0xfe, 0x00, 0x00, // ]
0x20, 0x40, 0x80, 0x40, 0x20, // ^
0x02, 0x02, 0x02, 0x02, 0x02, // _
0x00, 0x80, 0x40, 0x20, 0x00, // `
0x04, 0x2a, 0x2a, 0x2a, 0x1e, // a
0xfe, 0x12, 0x22, 0x22, 0x1c, // b
0x1c, 0x22, 0x22, 0x22, 0x04, // c
0x1c, 0x22, 0x22, 0x12, 0xfe, // d
0x1c, 0x2a, 0x2a, 0x2a, 0x18, // e
0x10, 0x7e, 0x90, 0x80, 0x40, // f
0x10, 0x28, 0x2a, 0x2a, 0x3c, // g
0xfe, 0x10, 0x20, 0x20, 0x1e, // h
0x00, 0x22, 0xbe, 0x02, 0x00, // i
0x04, 0x02, 0x22, 0xbc, 0x00, // j
0x00, 0xfe, 0x08, 0x14, 0x22, // k
0x00, 0x82, 0xfe, 0x02, 0x00, // l
0x3e, 0x20, 0x18, 0x20, 0x1e, // m
0x3e, 0x10, 0x20, 0x20, 0x1e, // n
0x1c, 0x22, 0x22, 0x22, 0x1c, // o
0x3e, 0x28, 0x28, 0x28, 0x10, // p
0x10, 0x28, 0x28, 0x18, 0x3e, // q
0x3e, 0x10, 0x20, 0x20, 0x10, // r
0x12, 0x2a, 0x2a, 0x2a, 0x04, // s
0x20, 0xfc, 0x22, 0x02, 0x04, // t
0x3c, 0x02, 0x02, 0x04, 0x3e, // u
0x38, 0x04, 0x02, 0x04, 0x38, // v
0x3c, 0x02, 0x0c, 0x02, 0x3c, // w
0x22, 0x14, 0x08, 0x14, 0x22, // x
0x30, 0x0a, 0x0a, 0x0a, 0x3c, // y
0x22, 0x26, 0x2a, 0x32, 0x22, // z
0x00, 0x10, 0x6c, 0x82, 0x00, // {
0x00, 0x00, 0xfe, 0x00, 0x00, // |
0x00, 0x82, 0x6c, 0x10, 0x00, // }
0x10, 0x10, 0x54, 0x38, 0x10, // ~
0x10, 0x38, 0x54, 0x10, 0x10, //
};
void setup() {
// Les pins de commande vont de 2 à 9
LEDS.addLeds<WS2811, 2, COLOR_ORDER>(ligne0, NUM_LEDS);
LEDS.addLeds<WS2811, 3, COLOR_ORDER>(ligne1, NUM_LEDS);
LEDS.addLeds<WS2811, 4, COLOR_ORDER>(ligne2, NUM_LEDS);
LEDS.addLeds<WS2811, 5, COLOR_ORDER>(ligne3, NUM_LEDS);
LEDS.addLeds<WS2811, 6, COLOR_ORDER>(ligne4, NUM_LEDS);
LEDS.addLeds<WS2811, 7, COLOR_ORDER>(ligne5, NUM_LEDS);
LEDS.addLeds<WS2811, 8, COLOR_ORDER>(ligne6, NUM_LEDS);
LEDS.addLeds<WS2811, 9, COLOR_ORDER>(ligne7, NUM_LEDS);
LEDS.setBrightness(255);
}
void loop() {
byte MessLength = sizeof(Message) * PIXELS;
InitTexte();
AfficheTexte();
for (int i = NUM_LEDS + 1; i <= MessLength; i++) {
DecaleTexte(i);
AfficheTexte();
}
}
void InitTexte() {
// On met dans le texte à afficher les valeurs en hexa
for (byte i = 0; i < NUM_LEDS; i++) {
byte NumLettre = i / PIXELS;
byte Numalpha = Message[NumLettre] - 32;
byte indice = i % PIXELS; // Position du pixel dans le caractère
if (indice == PIXELS - 1) Texte[i] = 0; // 1 espace en fin de caractère
else Texte[i] = Font5x7[(PIXELS - 1) * Numalpha + indice];
}
}
void DecaleTexte(int Pos) {
// Décalage de 1 pixel vers la gauche
for (byte i = 1; i < NUM_LEDS; i++) {
Texte[i - 1] = Texte[i];
}
// Ajout du dernier pixel
byte NumLettre = Pos / PIXELS + 1;
byte NumAlpha = Message[NumLettre] - 32;
byte indice = Pos % PIXELS; // Position du pixel dans le caractère
if (indice == 0) Texte[NUM_LEDS] = 0;
else Texte[NUM_LEDS] = Font5x7[(PIXELS - 1) * NumAlpha + indice];
}
void AfficheTexte() {
int ledColor = 0x0000FF; // Color used (in hex)
for (byte i = 0; i < NUM_LEDS; i++) {
ligne0[i] = ledColor * (Texte[i] && 0x10000000);
ligne1[i] = ledColor * (Texte[i] && 0x01000000);
ligne2[i] = ledColor * (Texte[i] && 0x00100000);
ligne3[i] = ledColor * (Texte[i] && 0x00010000);
ligne4[i] = ledColor * (Texte[i] && 0x00001000);
ligne5[i] = ledColor * (Texte[i] && 0x00000100);
ligne6[i] = ledColor * (Texte[i] && 0x00000010);
ligne7[i] = ledColor * (Texte[i] && 0x00000001);
}
FastLED.show();
delay(500); // <-- Vitesse d'affichage (à ajuster)
}
Ça compile, mais sur un nano ça dit que la mémoire est faible. En effet, je déclare 8 tableaux de 60 couleurs pour les 8 lignes (mais 7 peuvent suffire je pense) et ça prend pas mal de place.
Tu testes ?