#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
///#define MAX_ZONES 2
const int MAX_DEVICES = 15; //nombre d'appareils dans la chaîne
const int DATA_PIN = 11, CLK_PIN = 13; // DATA PIN et CLOCK PIN Communes aux 4 matrices
// CS_PIN = CS (Chip Select) pour chaque matrice.
const int CS_PIN_M1 = 10, CS_PIN_M2 = 9, CS_PIN_M3 = 8, CS_PIN_M4 = 7; // CS (Chip Select) pour chaque matrice.
//défini les broches utilisées pour se connecter à l'Arduino
//Ayant tout cela défini, nous pouvons également déclarer le module lui-même "Matrice_1"
MD_Parola Matrice_1 = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN_M1, MAX_DEVICES); // Matrice_1
MD_Parola Matrice_2 = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN_M2, MAX_DEVICES); // Matrice_2
MD_Parola Matrice_3 = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN_M3, MAX_DEVICES); // Matrice_3
MD_Parola Matrice_4 = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN_M4, MAX_DEVICES); // Matrice_4
static uint8_t display = 0; // Mode d'affichage actuel
char animations[29][25] = {"PA_PRINT",
"PA_SCROLL_UP",
"PA_SCROLL_DOWN",
"PA_SCROLL_LEFT",
"PA_SCROLL_RIGHT",
"PA_SPRITE",
"PA_SLICE",
"PA_MESH",
"PA_FADE",
"PA_DISSOLVE",
"PA_BLINDS",
"PA_RANDOM",
"PA_WIPE",
"PA_WIPE_CURSOR",
"PA_SCAN_HORIZ",
"PA_SCAN_HORIZX",
"PA_SCAN_VERT",
"PA_SCAN_VERTX",
"PA_OPENING",
"PA_OPENING_CURSOR",
"PA_CLOSING",
"PA_CLOSING_CURSOR",
"PA_SCROLL_UP_LEFT",
"PA_SCROLL_UP_RIGHT",
"PA_SCROLL_DOWN_LEFT",
"PA_SCROLL_DOWN_RIGHT",
"PA_GROW_UP",
"PA_GROW_DOWN"
};
char No[29][3] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28"};
void setup() {
Matrice_1.begin(); // démarrage de la matrice 1
Matrice_2.begin(); // démarrage de la matrice 2
Matrice_3.begin(); // démarrage de la matrice 3
Matrice_4.begin(); // démarrage de la matrice 4
}
void loop() {
int speed = 25;
Matrice_1.displayAnimate();
Matrice_2.displayAnimate();
Matrice_3.displayAnimate();
if (Matrice_1.getZoneStatus(0) &&
Matrice_2.getZoneStatus(0) &&
Matrice_3.getZoneStatus(0)) {
if (display == 6) speed = 0;
if (display == 8) speed = 150;
if (display == 10) speed = 150;
else speed = 25;
Matrice_1.displayText("Message", PA_CENTER, speed, 3000, display + 1, PA_SCROLL_UP);
Matrice_2.displayText(animations[display], PA_CENTER, 25, 3000, PA_PRINT, PA_NO_EFFECT);
Matrice_3.displayText(No[display], PA_CENTER, 25, 3000, PA_PRINT, PA_NO_EFFECT);
Matrice_3.displayReset(0);
Matrice_2.displayReset(0);
Matrice_1.displayReset(0);
display++; if (display > 28)display = 0;
}
/*
Matrice_1.setTextAlignment(PA_LEFT); //alignement
Matrice_1.print(" a gauche"); // affiche le texte
delay(3000); // Pendant 3 secondes
Matrice_1.setTextAlignment(PA_CENTER);//alignement
Matrice_1.print("au centre");// affiche le texte
delay(3000); // Pendant 3 secondes
Matrice_1.setTextAlignment(PA_RIGHT);//alignement
Matrice_1.print("a droite");// affiche le texte
delay(3000); // Pendant 3 secondes
*/
}
Matrice_1
Matrice_2
Matrice_3
Matrice_4