Matrices de 64 leds (8×8) connectée à un multiplexeur max7219
Attention : chaque LED consomme approximativement 50 mA. Lorsque les 64 LEDs sont allumées à l’intensité maximale la consommation sera d’environ 400 mA. Le port USB peut produire environ 500 mA, si plusieurs matrices sont connectées, une alimentation externe pourra être nécessaire.
Connexion : Connectez la carte Arduino au dernier pavé de led puis sa connexion DOUT au DIN du pavé suivant. La chaîne des pavés de leds allant de la droite vers la gauche.
| Arduino | MAX7219 |
| --------- | --------------- |
| MOSI (11) | DIN (1) |
| SCK (13) | CLK (13) |
| I/O (7)* | LOAD/CS (12) |
A étudier : https://www.pjrc.com/teensy/td_libs_Matrix.html
et https://code.google.com/p/arudino-maxmatrix-library/
Les librairies à charger sont ici (matrix) et là (sprite)
Les exemples sont là (ExemplesMatriceSprite)
La disposition des matrices que j’ai choisi est celle où le CI max7219 est placé en haut du pavé de LED. Ainsi les matrices peuvent être acolées. Basée sur les libraies ci dessus, voici deux sketchs :
* l’un permettant d’allumer une led par ses coordonnées X allant de 0 à 15 (deux matrices) et Y allant de 0 à 7
* L’autre déplaçant les lettres LED de gauche à droite
Sans librairie :
/*
Basic code for using Maxim MAX7219/MAX7221 with Arduino.
Wire the Arduino and the MAX7219/MAX7221 together as follows:
| Arduino | MAX7219/MAX7221 |
| --------- | --------------- |
| MOSI (11) | DIN (1) |
| SCK (13) | CLK (13) |
| I/O (7)* | LOAD/CS (12) |
* - This should match the LOAD_PIN constant defined below.
For the rest of the wiring follow the wiring diagram found in the datasheet.
Datasheet: http://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf
Author: Nicholas Dobie <nick@nickdobie.com>
Date: 30 December 2013
License: WTFPL (http://www.wtfpl.net/)
*/
#include <SPI.h>
// What pin on the Arduino connects to the LOAD/CS pin on the MAX7219/MAX7221
#define LOAD_PIN 7
/**
* Transfers data to a MAX7219/MAX7221 register.
*
* @param address The register to load data into
* @param value Value to store in the register
*/
void maxTransfer(uint8_t address, uint8_t value) {
// Ensure LOAD/CS is LOW
digitalWrite(LOAD_PIN, LOW);
// Send the register address
SPI.transfer(address);
// Send the value
SPI.transfer(value);
// Tell chip to load in data
digitalWrite(LOAD_PIN, HIGH);
}
void setup() {
// Set load pin to output
pinMode(LOAD_PIN, OUTPUT);
// Reverse the SPI transfer to send the MSB first
SPI.setBitOrder(MSBFIRST);
// Start SPI
SPI.begin();
// Run test
// All LED segments should light up
maxTransfer(0x0F, 0x01);
delay(1000);
maxTransfer(0x0F, 0x00);
// Enable mode B
maxTransfer(0x09, 0xFF);
// Use lowest intensity
maxTransfer(0x0A, 0x00);
// Only scan one digit
maxTransfer(0x0B, 0x00);
// Turn on chip
maxTransfer(0x0C, 0x01);
}
void loop() {
// Loop through each code
for (uint8_t i = 0; i < 0x10; ++i)
{
maxTransfer(0x01, i);
delay(500);
}
}
Utilisation de la librairie MAXMATRIX:
http://www.best-microcontroller-projects.com/max7219.html
http://forum.hobbycomponents.com/viewtopic.php?f=75&t=1737
Sketch et librairie ici
Exemple avec saisie de texte
Utilisation des librairies PAROLA et MD_MAX72xx :
Librairies et exemples à télécharger ici
https://arduinoplusplus.wordpress.com/
Redéfinition des caractères :
Sous Excel et en C utilitaire
UTILISATION DU KIT LEDS « 4 In 1 Display«
Utilisez la librairie MD_MAX avec le support F16 :
Modifiez le fichier MD_MAX72xx.h :
#define USE_PAROLA_HW 0
#define USE_FC16_HW 1
Votre commentaire