Hello LED matrix display
In this article I’ll show how to use LED matrix display with Arduino UNO. We’ll see how to control single pixel and implement the game of life.
Components
Arduino UNO | 8x8 LED matrix display |
Usage
We are going to use a module with 8x8 matrix display and MAX7219CNG display driver to reduce number of pins and simplify control.
We’ll include a library
:::c
#include <LedControl.h>
Pin numbers we are going to use are described in code below
:::c
#define CLK 8
#define CS 9
#define DIN 10
Controlling single pixel
Let’s look at the whole sketch which lights one pixel
:::c
#include <LedControl.h>
#define CLK 8
#define CS 9
#define DIN 10
LedControl lc = LedControl(DIN, CLK, CS, 1 /* number of displays attached */);
#define DISPLAY_INDEX 0
void setup() {
lc.shutdown(DISPLAY_INDEX, false);
lc.setIntensity(DISPLAY_INDEX, 8);
lc.setLed(DISPLAY_INDEX, 3/*X*/, 4/*Y*/, 1/*HIGH*/);
}
void loop() {
}
Final result should look like this.
The Game of Life
Now let’s do something more interesting and implement the game of life. The source code can be found here. There are several configurations changing one another thus forming beautiful animation like on the video below.