#include <MD_Parola.h> // inclure la bibliothèque MajicDesigns Parola
#include <MD_MAX72xx.h> // inclure la bibliothèque de matrices LED MajicDesigns MAX72xx
#include <SPI.h> // inclure la bibliothèque Arduino SPI
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
//#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_ZONES 10
const int DATA_PIN = 11, CLK_PIN = 13; // DATA PIN et CLOCK PIN Communes aux 4 matrices
const int CS_PIN_M1 = 10, CS_PIN_M2 = 9, CS_PIN_M3 = 8, CS_PIN_M4 = 7; // CS (Chip Select) pour chaque matrice.
const int MAX_DEVICES = 21; //nombre d'appareils que nous avons dans la chaîne et l'interface matérielle
// MATÉRIEL SPI
//MD_Parola disp = MD_Parola(HARDWARE_TYPE, CS_PIN_M1, MAX_DEVICES);
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 1
// Tampons de messages globaux partagés par les fonctions série et de défilement
#define BUF_SIZE 75 // longeur du tampon
char curMessage[BUF_SIZE] = { "" };
char Message1[BUF_SIZE] = { "Cipad 60e Edition" };
char Message2[BUF_SIZE] = { "Matrice de points max7219" };
char Message3[BUF_SIZE] = { "Calendrier" };
char Message4[BUF_SIZE] = { "Horloge" };
char Message5[BUF_SIZE] = { "Tempetature & Humidity" };
void setup() {
lcd.init(); lcd.backlight();
Matrice_1.begin(); Matrice_2.begin();
Matrice_1.setIntensity(0); Matrice_2.setIntensity(0);
Matrice_1.displayClear(); Matrice_2.displayClear();
Matrice_1.displayText(Message1, PA_CENTER, 50, 1200, PA_SCROLL_RIGHT, PA_SCROLL_DOWN);
Matrice_2.displayText(Message2, PA_CENTER, 5, 500, PA_SCROLL_LEFT, PA_SCROLL_UP);
}
void loop() {
if (Matrice_1.displayAnimate()) Matrice_1.displayReset();
if ( Matrice_2.displayAnimate()) Matrice_2.displayReset();
//}
}
/*
if (Matrice_1.displayAnimate()) {
if(Matrice_1.getZoneStatus(0) && Matrice_1.getZoneStatus(1)) {
Matrice_1.displayReset();
}
}
/*
}
/*
//if (Matrice_1.displayAnimate()) Matrice_1.displayReset(0);
// Matrice_2.displayAnimate();
lcd.setCursor(0, 0); lcd.print(display);
if (display == 0) {
lcd.setCursor(0, 0); lcd.print(display);
Matrice_1.setTextAlignment(PA_LEFT);
Matrice_1.print("ALIGNEMENT : GAUCHE ");
Matrice_2.setTextAlignment(PA_CENTER);
Matrice_2.print("setTextAlignment(PA_LEFT)");
display++; delay(2000);
}
if (display == 1) {
lcd.setCursor(0, 0); lcd.print(display);
Matrice_1.setTextAlignment(PA_CENTER);
Matrice_1.print("ALIGNEMENT : CENTRE");
Matrice_2.setTextAlignment(PA_CENTER);
Matrice_2.print("setTextAlignment(PA_CENTER)");
display++; delay(2000);
}
if (display == 2) {
lcd.setCursor(0, 0); lcd.print(display);
Matrice_1.setTextAlignment(PA_RIGHT);
Matrice_1.print("ALIGNEMENT : DROITE");
Matrice_2.setTextAlignment(PA_CENTER);
Matrice_2.print("setTextAlignment(PA_RIGHT)");
display++;
delay(2000);
}
if (display == 3) {
lcd.setCursor(0, 0); lcd.print(display);
Matrice_1.setTextAlignment(PA_CENTER);
bool inv = true;
char VraiFaux[2][6] = {"false", "true"};
for (int i = 0; i < 10; i++) {
inv = !inv;
Matrice_1.setInvert(inv);
Matrice_1.print("INVERSION DE L'AFFICHAGE");
Matrice_2.setTextAlignment(PA_CENTER);
Matrice_2.print("setInvert(" + String(VraiFaux[inv]) + ")" );
delay(1000);
}
Matrice_2.print("");
display++;
}
if (display == 4) {
lcd.setCursor(0, 0); lcd.print(display);
Matrice_1.setInvert(false);
Matrice_1.print(Message1);
Matrice_2.print("Message1");
delay(2000);
Matrice_1.print(Message2);
Matrice_2.print("Message2");
delay(2000);
Matrice_1.print(Message3);
Matrice_2.print("Message3");
delay(2000);
Matrice_1.print(Message4);
Matrice_2.print("Message4");
delay(2000);
Matrice_1.print(Message5);
Matrice_2.print("Message5");
delay(2000);
Matrice_1.displayReset(0);
display++;
}
if (display == 5) {
display = 0;
Matrice_1.setTextAlignment(PA_CENTER);
Matrice_1.setInvert(true);
Matrice_1.print("Vidage de la matrice_1"); delay(2000);
Matrice_1.print("");
delay(2000);
Matrice_2.setTextAlignment(PA_CENTER);
Matrice_2.setInvert(true);
Matrice_2.print("Vidage de la matrice_2"); delay(1000);
Matrice_2.print("");
delay(2000);
Matrice_1.setInvert(false); Matrice_1.print("");
Matrice_2.setInvert(false); Matrice_2.print("");
delay(2000);
}
}
*/