簡單串口調試工具 Electron 版本

界面

功能都比較簡單,串口和波特率寫死在代碼了。
在這裏插入圖片描述

構建項目可能會有node版本的問題,需要重構node依賴

npm install
npm install serialport 
npm install electron-rebuild --save-dev
.\node_modules\.bin\electron-rebuild.cmd
npm install electron-builder --dev

執行代碼是在index.js ,所以 main.js 要開啓Node Api的權限 nodeIntegration 要設置爲true

function createWindow () {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      nodeIntegration: true
    }
  })
  ..............
 }

代碼地址: https://github.com/linzl008/serialport-electron.git

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章