/* Test d'un afficheur graphique 1088AS piloté avec un MAX7219CNG */
#include "LedControl.h"
/* Initialisation :
E/S n° 4 branchée sur DataIn.
E/S n° 2 branchée sur CLK
E/S n° 3 branchée sur CS
Un seul MAX7219 est sur la ligne.
*/
LedControl Matrice=LedControl(4,2,3,1);
void setup() {
/* Le MAX7219 est en mode d'économie de courant au démarrage. */
Matrice.shutdown(0,false); // réveiller le MAX7219.
Matrice.setIntensity(0,8); // Ajuster à la luminosité minimale.
Matrice.clearDisplay(0);} // Effacer l'afficheur.
void loop() {
Matrice.shutdown(0,true);
delay(1000);
Matrice.shutdown(0,false);
Afficher_le_grand_carre(); Ajouter_la_croix(); Matrice.clearDisplay(0);
Afficher_le_carre_moyen(); Matrice.clearDisplay(0);
Afficher_le_carre_3(); Matrice.clearDisplay(0);
Afficher_le_petit_carre(); Matrice.clearDisplay(0); delay(1000);
Afficher_le_grand_carre();Afficher_le_carre_moyen();
Afficher_le_carre_3();Afficher_le_petit_carre();
Matrice.clearDisplay(0); delay(1000); }
void Afficher_le_grand_carre() {
/* Données pour générer la matrice de caractère. */
byte C1[2]={B11111111,B10000001};
/* Afficher le grans carré. */
Matrice.setRow(0,0,C1[0]);
Matrice.setRow(0,1,C1[1]);
Matrice.setRow(0,2,C1[1]);
Matrice.setRow(0,3,C1[1]);
Matrice.setRow(0,4,C1[1]);
Matrice.setRow(0,5,C1[1]);
Matrice.setRow(0,6,C1[1]);
Matrice.setRow(0,7,C1[0]);
delay(1000); }
void Ajouter_la_croix() {
/* Données pour générer la matrice de caractère. */
byte CRX[3]={B11000011,B10100101,B10011001};
/* Ajouter la croix. */
Matrice.setRow(0,1,CRX[0]);
Matrice.setRow(0,2,CRX[1]);
Matrice.setRow(0,3,CRX[2]);
Matrice.setRow(0,4,CRX[2]);
Matrice.setRow(0,5,CRX[1]);
Matrice.setRow(0,6,CRX[0]);
delay(1000); }
void Afficher_le_carre_moyen() {
/* Données pour générer la matrice de caractère. */
byte C2[2]={B01111110,B01000010};
/* Afficher le carré moyen. */
Matrice.setRow(0,1,C2[0]);
Matrice.setRow(0,2,C2[1]);
Matrice.setRow(0,3,C2[1]);
Matrice.setRow(0,4,C2[1]);
Matrice.setRow(0,5,C2[1]);
Matrice.setRow(0,6,C2[0]);
delay(1000); }
void Afficher_le_carre_3() {
/* Données pour générer la matrice de caractère. */
byte C3[2]={B00111100,B00100100};
/* Afficher le troisième carré. */
Matrice.setRow(0,2,C3[0]);
Matrice.setRow(0,3,C3[1]);
Matrice.setRow(0,4,C3[1]);
Matrice.setRow(0,5,C3[0]);
delay(1000); }
void Afficher_le_petit_carre() {
/* Données pour générer la matrice de caractère. */
byte C4[1]={B00011000};
/* Afficher le petit carré. */
Matrice.setRow(0,3,C4[0]);
Matrice.setRow(0,4,C4[0]);
delay(1000); }