2018年3月7日 星期三

安裝Node-RED

安裝Node-RED

參考
https://nodered.org/docs/platforms/windows
https://makerpro.cc/2017/04/use-node-red-for-iot-development/


1. Install Node.js
Download the latest 8.x LTS version of Node.js from the official Node.js home page. It will offer you the best version for your system.
Run the downloaded MSI file. Installing Node.js requires local administrator rights; if you are not a local administrator, you will be prompted for an administrator password on install. Accept the defaults when installing. After installation completes, close any open command prompts and re-open to ensure new environment variables are picked up.
Once installed, open a command prompt and run the following command to ensure Node.js and npm are installed correctly.
Using Powershell: node --version; npm --version
Using cmd: node --version && npm --version
You should receive back output that looks similar to:
v8.9.0
5.5.1

2. Install Node-RED

Installing Node-RED as a global module adds the command node-red to your system path. Execute the following at the command prompt:
npm install -g --unsafe-perm node-red

3. Run Node-RED

Running on Windows

Once installed, the simple way to run Node-RED is to use the node-red command in a command prompt: If you have installed Node-RED as a global npm package, you can use the node-red command:
C:>node-red

進入瀏覽器  http://127.0.0.1:1880/









IBM發行了一套開源視覺化界面開發工具 - Node-RED,嗯?是不是有點眼熟?怎麼跟著名的程式語言Node.js有些相似?不用擔心,即使完全不懂怎麼撰寫Node.js,也能學會使用Node-RED。接下來就讓我們一起看看如何運用Node-RED吧!
大家可能會好奇,Node-RED跟Node.js怎麼名字會這麼像? 是不是有某種關聯存在? 這邊就要先從Node.js開始介紹了。Node.js是一個讀取Javascript的運行環境,可用於開發網頁後端程式,但是Node.js的指令是一行一行寫出來的,為了免去呼叫程式碼麻煩,IBM的工程師開發了Node-RED來更容易地完成工作。
具體來說,每當啟動Node-RED時,背景程式便會創造一個伺服器來處理我們輸入的指令,這時只要使用瀏覽器登入指定的IP即可進入Node-RED的編輯畫面,設定好想要的流程後,背景程式會將流程轉換成程式碼交給Node.js環境運行。
其實在Maker圈,視覺化界面開發工具已經相當流行,特別是MIT開發的Scratch,以及Google開發的Blockly。那麼,Node-RED跟這兩大視覺開發工具相比,又有什麼樣的優勢呢?
Node-REDScratchBlockly
優點各式API、適合用於概念性驗證淺顯易懂、逗趣的圖案用網頁操作、淺顯易懂
特色可用樹梅派開發IOT應用程式邏輯教學、控制Arduino控制Arduino
語言英文中文中文

Node-RED特色

Node-RED起源於2013年IBM’s Emerging Technology Services group的一個計畫的副產物,工程師Nick O’Leary和Dave Conway-Jones想用視覺化界面來概念性驗證一套MQTT應用,讓Node-RED因此孕育而生。
Node-RED很快成為更加全面性的開發工具,並於2013年9月成為Open Source,於2016年10月加入JS Foundation。(以上說明節錄自Node-RED官網)
Node-RED提供各式的API,包括網際網路服務,例如推特與查詢天氣、呼叫使用各式的通訊協定,例如MQTT、TCP、UDP等;在嵌入式系統上,Node-RED提供控制GPIO的功能,並使用MQTT或是HTTP等協定與雲端做溝通,架構IOT產品。
讓Node-RED流行於各大網路社群的理由,在於它擁有以下諸多的優點:
  1. 相較於撰寫程式碼,使用圖形化界面可更快速開發。
  2. 適合作為概念性應用驗證的開發工具。
  3. 淺顯易懂,每個API都有文字說明可供查詢。
  4. 具有高度擴充性,已有大量的Library、Flow、Node供人下載。



沒有留言:

張貼留言

Node-Red & ModeBus FC=1

Node-Red & ModeBus FC=1 write address=0..7   8bits read address=16..23 8bits  [{"id":"cf7c1253d4d997dd","type&q...