小屋創作

日誌2018-09-18 20:39

安裝Node-RED在Raspberry Pi

作者:Jia

Node-RED
(此教學皆以在Raspberry Pi平臺上執行)

官方簡介
Node-RED is a programming tool for wiringtogether hardware devices, APIs and online services in new and interestingways.
It provides a browser-based editor that makesit easy to wire together flows using the wide range of nodes in the palettethat can be deployed to its runtime in a single-click.
 


開始安裝
建議一開始可以先系統更新。
開啟Terminal終端機輸入以下指令:
>> sudo apt-get update      (更新)
>> sudo apt-get upgrade    (升級)


輸入指令安裝Node-RED:
>> bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)



等待全部跑完後
檢查安裝:
>> node -v
會跑出Node-RED的版本號。

 

啟動 NodeRED:
>> node-red


開啟瀏覽器測試:
http://IP:1880



到這裡為止就算完成安裝了。
接下來寫個測試範例,輸入一句話並輸出。
在左方欄位中拖曳出兩個節點,並連接起來。
  • input > inject
  • output > debug

 

雙擊inject修改Payload為自己想打的話。

 

接下來把它部屬上去,點擊右上角紅色按鈕Deploy,
會顯示部屬成功訊息。

 

點擊inject左方小框框(紅箭頭),它就會發送訊息,並在右方debug訊息框看到接收到的資料。
* debug節點的右方小框框(藍箭頭)要記得打開。




※ 開機時自動啟動
如果希望在Raspberry Pi開機後自動運行Node-RED,輸入以下指令:
>> sudo systemctl enable nodered.service


如需要更多的介紹,請參考官方資料
Node-RED User Guide:https://nodered.org/docs/user-guide/

2

3

LINE 分享

相關創作

Wyliodrin介紹及創建教學–使用Raspberry Pi 3 (1)

Wyliodrin簡易燒錄教學–使用Raspberry Pi 3 (2)

如何安裝OpenCV 在Raspberry Pi

留言

開啟 APP

face基於日前微軟官方表示 Internet Explorer 不再支援新的網路標準,可能無法使用新的應用程式來呈現網站內容,在瀏覽器支援度及網站安全性的雙重考量下,為了讓巴友們有更好的使用體驗,巴哈姆特即將於 2019年9月2日 停止支援 Internet Explorer 瀏覽器的頁面呈現和功能。
屆時建議您使用下述瀏覽器來瀏覽巴哈姆特:
。Google Chrome(推薦)
。Mozilla Firefox
。Microsoft Edge(Windows10以上的作業系統版本才可使用)

face我們了解您不想看到廣告的心情⋯ 若您願意支持巴哈姆特永續經營,請將 gamer.com.tw 加入廣告阻擋工具的白名單中,謝謝 !【教學】