====== MAX7219 ====== Afficheur matricielle de LEDS 8x8 et chaînable. {{:materiel:max7219:img_20170502_103531.jpg?600|}} **Ressources** * http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display-driver-ic/ * http://playground.arduino.cc/LEDMatrix/Max7219 ===== Texte défilant ===== {{:materiel:max7219:img_20170502_103456.jpg?600|}} **Installer deux bibliothèques** * Télécharger [[Max72xxPanel|https://github.com/markruys/arduino-Max72xxPanel/archive/master.zip]], renommer la en "Max72xxPanel" * à partir d'Arduino, inclure la bibliothèque "Adafruit_GFX" **Connectiques Nano** * D13 > CLK * D11 > DIN * D10 > CS **Code** Code pour déplacer un texte : #include #include #include int pinCS = 10; // Attach CS to this pin, DIN to MOSI and CLK to SCK (cf http://arduino.cc/en/Reference/SPI ) int numberOfHorizontalDisplays = 4; // Number of Matrix int numberOfVerticalDisplays = 1; Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays); String tape = "SANG CORPS RESTE PONT DANCE"; int wait = 40; // In milliseconds int spacer = 1; int width = 5 + spacer; // The font width is 5 pixels void setup() { matrix.setIntensity(3); // Use a value between 0 and 15 for brightness // Rotate the matrix in line matrix.setRotation(0, 1); matrix.setRotation(1, 1); matrix.setRotation(2, 1); matrix.setRotation(3, 1); } void loop() { for ( int i = 0 ; i < width * tape.length() + matrix.width() - 1 - spacer; i++ ) { matrix.fillScreen(LOW); int letter = i / width; int x = (matrix.width() - 1) - i % width; int y = (matrix.height() - 8) / 2; // center the text vertically while ( x + width - spacer >= 0 && letter >= 0 ) { if ( letter < tape.length() ) { matrix.drawChar(x, y, tape[letter], HIGH, LOW, 1); } letter--; x -= width; } matrix.write(); // Send bitmap to display delay(wait); } }