【 IoT 】MediaTek LinkIt™ 7697 串接 Mosquitto
內容
- 學習目標
- 前置準備作業
- MediaTek LinkIt™ 7697 串接 Mosquitto
- 撰寫 Arduino 程式
- 透過 Node-RED 控制 LinkIt 7697 的 LED
學習目標
- 如何透過 MediaTek LinkIt™ 7697 串接 Mosquitto
所需材料
- MediaTek LinkIt™ 7697
- Micro USB Cable
前置準備作業
- MediaTek LinkIt™ 7697 起手式
- 已安裝 Mosquitto
- 已安裝 Node-RED
- 已建立 Node-RED 串接 Mosquitto
MediaTek LinkIt™ 7697 串接 Mosquitto
Step 1. 開啟 Arduino IDE
-
Arduino IDE 使用的版本為
1.8.2
Step 2. 安裝 PubSubClient 套件
-
2.1 點選上方
草稿碼>匯入程式庫>管理程式庫...
-
2.2 在右上角的
過濾尋找結果...欄位輸入PubSubClient

-
2.3 點選
PubSubClient中版本為2.6.0右邊的安裝
-
2.4 安裝完成畫面

撰寫 Arduino 程式
Step 1. 串接 Mosquitto 程式
- 第 4 行:等號右方雙引號中輸入的
SSID請更改成所要使用的WIFI AP的名稱 - 第 5 行:等號右方雙引號中輸入的
PASSWORD請更改成所要使用的WIFI AP的密碼 - 第 6 行:等號右方雙引號中輸入的
MOSQUITTO-IP請更改成 Mosquitto 所在的 IP,在此請輸入 Azure IP
Step 2. 燒錄程式碼到 LinkIt 7697
-
2.1 選擇 LinkIt 7697 開發板

-
2.2 選擇序列埠

-
2.3 點選左上角的向右箭頭上傳程式碼到 LinkIt 7697

透過 Node-RED 控制 LinkIt 7697 的 LED
Step 1. 開啟 LinkIt 7697 LED 測試
-
點選 Node-RED 的
1按鈕以開啟 LinkIt 7697 LED
-
Node-RED 執行成功

-
MediaTek LinkIt™ 7697 的 LED 亮起

Step 2. 關閉 LinkIt 7697 LED 測試
-
點選 Node-RED 的
0按鈕以關閉 LinkIt 7697 LED
-
Node-RED 執行成功

-
MediaTek LinkIt™ 7697 的 LED 關閉
