【 IoT 】MediaTek LinkIt™ 7697 串接 Mosquitto

【 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

Step 1. 開啟 Arduino IDE

  • Arduino IDE 使用的版本為 1.8.2

    ----17

Step 2. 安裝 PubSubClient 套件

  • 2.1 點選上方 草稿碼 > 匯入程式庫 > 管理程式庫...

    ----18

  • 2.2 在右上角的 過濾尋找結果... 欄位輸入 PubSubClient

    ----19

    ----20

  • 2.3 點選 PubSubClient 中版本為 2.6.0 右邊的 安裝

    ----22

  • 2.4 安裝完成畫面

    ----23


撰寫 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 開發板

    ----25

  • 2.2 選擇序列埠

    ----26

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

    ----24


透過 Node-RED 控制 LinkIt 7697 的 LED

Step 1. 開啟 LinkIt 7697 LED 測試

  • 點選 Node-RED 的 1 按鈕以開啟 LinkIt 7697 LED

    ---2020-05-25---1.51.27

  • Node-RED 執行成功

    ---2020-05-25---1.54.14

  • MediaTek LinkIt™ 7697 的 LED 亮起

    ---2020-05-25---2.00.20


Step 2. 關閉 LinkIt 7697 LED 測試

  • 點選 Node-RED 的 0 按鈕以關閉 LinkIt 7697 LED

    ---2020-05-25---1.56.06

  • Node-RED 執行成功

    ---2020-05-25---1.57.10

  • MediaTek LinkIt™ 7697 的 LED 關閉

    ---2020-05-25---2.00.00


GitHub
List of blogs