วิธีการต่อใช้งาน Arduino LED Matrix MAX7219
Arduino -> LED Matrix MAX7219
- 5V-> VCC
- GND -> GND
- ขา 12 - DataIn
- pin 11 - CLK
- pin 10 - CS
โหลด Library LED Matrix MAX7219 ติดตั้งลง Arduino IDE
1
//We always have to include the library
2
#include "LedControl.h"
5
Now we need a LedControl to work with.
6
***** These pin numbers will probably not work with your hardware *****
7
pin 12 is connected to the DataIn
8
pin 11 is connected to the CLK
9
pin 10 is connected to LOAD
10
We have only a single MAX72XX.
12
LedControl lc=LedControl(12,11,10,1);
14
/* we always wait a bit between updates of the display */
15
unsigned long delaytime=100;
19
The MAX72XX is in power-saving mode on startup,
20
we have to do a wakeup call
23
/* Set the brightness to a medium values */
25
/* and clear the display */
30
This method will display the characters for the
31
word "Arduino" one after the other on the matrix.
32
(you need at least 5x7 leds to see the whole chars)
34
void writeArduinoOnMatrix() {
35
/* here is the data for the characters */
36
byte a[5]={B01111110,B10001000,B10001000,B10001000,B01111110};
37
byte r[5]={B00111110,B00010000,B00100000,B00100000,B00010000};
38
byte d[5]={B00011100,B00100010,B00100010,B00010010,B11111110};
39
byte u[5]={B00111100,B00000010,B00000010,B00000100,B00111110};