# Max7219 8X8 矩陣LED模組

![](https://1275793585-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LaZQFBYOS3O0ksiEmR1%2F-Lx00XGnqAn7JxlS80YM%2F-Lx08nbETEONyrHUMyo_%2F01.png?alt=media\&token=7f1a31d5-e838-498c-b455-774f797e04b0)

## 專案說明

使用「科易KEYES Arduino UNO R3 開發板」連接「Max7219 8X8 矩陣LED模組」, 在Max7219 8X8 矩陣LED模組上顯示「Hello World」。

此**Max7219 8X8 矩陣LED模組**包含於「[洞洞兩教學材料包 Education Kit 002](https://www.robotkingdom.com.tw/product/rk-education-kit-002/)」內。

## KEYES Arduino UNO R3電路圖

* [KEYES Arduino UNO R3&#x20;  ](https://www.robotkingdom.com.tw/product/keyes-uno-r3/)
* 通用型彩色Sensor shield v5.0感測器擴充板
* Max7219 8X8 矩陣LED模組

**Max7219 8X8 矩陣LED模組**是**數位訊號**輸出， 可以接「D0 \~ D13」的 KEYES Arduino UNO R3訊號端上。 本範例連接到「**D5**」←→「**dataPin**」，「**D4**」**←→**「**csPin**」，「**D3**」**←→**「**clkPin**」

![](https://1275793585-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LaZQFBYOS3O0ksiEmR1%2F-Lx00XGnqAn7JxlS80YM%2F-Lx09_HTKTbu0GeocC8J%2F02.png?alt=media\&token=e7ded07d-9b05-419a-8afc-243c6c7f5ad4)

## Arduino 程式

由於Max7219 8X8 矩陣LED模組是函式庫型模組，所以需要先在Arduino上下載函式庫，下載方法如下。

在Arduino上選擇工具，選擇管理程式庫，在管理程式庫搜尋MatrizLed選擇MatrizLed by Daniel Alvarez版本2.0.3並安裝。

![](https://1275793585-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LaZQFBYOS3O0ksiEmR1%2F-Lx00XGnqAn7JxlS80YM%2F-Lx09oZ9YeIo-1FelskQ%2F03.png?alt=media\&token=d7b7dde8-f7f0-4195-b71e-b79fc30bf430)

![](https://1275793585-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LaZQFBYOS3O0ksiEmR1%2F-Lx00XGnqAn7JxlS80YM%2F-Lx09t8QEei4Z1nSxiCs%2F04.png?alt=media\&token=0f720d74-9876-4c5d-a93e-4cf6fe004ef6)

在Max7219 8X8 矩陣LED模組上間隔0.2秒由右至左以跑馬燈的形式顯示「Hello World」文字 。

產生出的 Arduino 程式如下

```c
#include <MatrizLed.h>
MatrizLed pantalla;

void setup() {
  pantalla.begin(5, 3, 4, 2); // dataPin, clkPin, csPin, numero de matrices de 8x8
}

void loop() { 
  pantalla.borrar();
  pantalla.escribirFraseScroll("Hello World", 200); 
}

```
