In this example we again use the MAX7219 but this time we will be driving an 8×8 LED matrix like the following module
The MAX7219/MAX7221 are compact, serial input/output common-cathode display drivers that interface microprocessors (µPs) to 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs. Included on-chip are a BCD code-B decoder, multiplex scan circuitry, segment and digit drivers, and an 8×8 static RAM that stores each digit. Only one external resistor is required to set the segment current for all LEDs.
The MAX7221 is compatible with SPI™, QSPI™, and MICROWIRE™, and has slewrate-limited segment drivers to reduce EMI.
A convenient 4-wire serial interface connects to all common µPs. Individual digits may be addressed and updated without rewriting the entire display. The MAX7219/MAX7221 also allow the user to select codeB decoding or no-decode for each digit.
Here is a picture of the module
AliExpress.com Product – 15963 Free Shipping MAX7219 Dot Led Matrix Module MCU LED Display Control Module Kit For Arduino
Code
You will need the LedControl library – http://wayoda.github.io/LedControl/pages/software.html
[codesyntax lang=”cpp”]
#include "LedControl.h" /* Now we need a LedControl to work with. ***** These pin numbers will probably not work with your hardware ***** pin 7 is connected to the DataIn pin 6 is connected to the CLK pin 5 is connected to LOAD We have only a single MAX72XX. */ LedControl lc=LedControl(7,6,5,1); void setup() { // the zero refers to the MAX7219 number lc.shutdown(0,false);// turn off power saving lc.setIntensity(0,4);// sets brightness (0~15 possible values) lc.clearDisplay(0);// clear screen } void loop() { for (int row=0; row<8; row++) { for (int col=0; col<8; col++) { lc.setLed(0,col,row,true); // turns on LED at col, row delay(25); } } for (int row=0; row<8; row++) { for (int col=0; col<8; col++) { lc.setLed(0,col,row,false); // turns off LED at col, row delay(25); } } }
[/codesyntax]
Links
MAX7219 Dot Led Matrix Module MCU LED Display Control Module Kit For Arduino