约翰尼五世无法连接到 Arduino
Johnny-Five Unable to Connect to Arduino
Windows 10、Arduino Micro。我最初使用的是标准 "Blink.js" 教程,但约翰尼五一直连接到错误的串行端口。我对我的 COM 端口(在本例中为端口 8)进行了硬编码,并克服了最初的错误,但是一个新的错误阻止了我。我的输出如下所示:
C:\Users\...\folder>node Blink.js
1536475383667 Connected COM 8
1536475383673 Error Opening COM 8: File not found
(node:12700) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Uncaught, unspecified "error" event. ([object Object])
1536475393671 Device or Firmware Error A timeout occurred while connecting to the Board.
Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting
If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again.
events.js:165
throw err;
^
Error: Uncaught, unspecified "error" event. ([object Object])
at Board.emit (events.js:163:17)
at Board.log (C:\Users\...\folder\node_modules\johnny-five\lib\board.js:648:8)
at Board.(anonymous function) [as error] (C:\Users\...\folder\node_modules\johnny-five\lib\board.js:659:14)
at Board.<anonymous> (C:\Users\...\folder\node_modules\johnny-five\lib\board.js:395:14)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
我已经完成了他们推荐的所有显而易见的事情:重新刷新固件,刻录引导加载程序,重新安装节点和 npm,逐步完成 Arduino 的安装说明,尽管我必须通过 GUI 而不是命令行推送 standardFirmataPlus.ino,因为 Windows 本身不包含 Arduino 的命令行工具。我的代码,如果有什么不同的话,看起来是这样的:
var five = require("johnny-five"),
board, led;
board = new five.Board({port: "COM 8"});
board.on("ready", function() {
console.log('ready');
led = new five.Led(8); //This would be port 13 on most, but the Micro doesn't have that port
led.strobe(100);
});
多年来,我一直在努力从使用 Johnny-Five 的 Arduino 那里得到任何反应,我们将不胜感激。
事实证明,问题是交叉兼容性问题。我使用 Git 在计算机之间同步文件和项目,一台计算机是 Mac,另一台计算机是 Windows。与许多其他 JavaScript 包不同,serialport 是一个特定于平台的包。所以,学着用gitignore吧。
希望这对其他人有帮助。
Windows 10、Arduino Micro。我最初使用的是标准 "Blink.js" 教程,但约翰尼五一直连接到错误的串行端口。我对我的 COM 端口(在本例中为端口 8)进行了硬编码,并克服了最初的错误,但是一个新的错误阻止了我。我的输出如下所示:
C:\Users\...\folder>node Blink.js
1536475383667 Connected COM 8
1536475383673 Error Opening COM 8: File not found
(node:12700) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Uncaught, unspecified "error" event. ([object Object])
1536475393671 Device or Firmware Error A timeout occurred while connecting to the Board.
Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting
If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again.
events.js:165
throw err;
^
Error: Uncaught, unspecified "error" event. ([object Object])
at Board.emit (events.js:163:17)
at Board.log (C:\Users\...\folder\node_modules\johnny-five\lib\board.js:648:8)
at Board.(anonymous function) [as error] (C:\Users\...\folder\node_modules\johnny-five\lib\board.js:659:14)
at Board.<anonymous> (C:\Users\...\folder\node_modules\johnny-five\lib\board.js:395:14)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
我已经完成了他们推荐的所有显而易见的事情:重新刷新固件,刻录引导加载程序,重新安装节点和 npm,逐步完成 Arduino 的安装说明,尽管我必须通过 GUI 而不是命令行推送 standardFirmataPlus.ino,因为 Windows 本身不包含 Arduino 的命令行工具。我的代码,如果有什么不同的话,看起来是这样的:
var five = require("johnny-five"),
board, led;
board = new five.Board({port: "COM 8"});
board.on("ready", function() {
console.log('ready');
led = new five.Led(8); //This would be port 13 on most, but the Micro doesn't have that port
led.strobe(100);
});
多年来,我一直在努力从使用 Johnny-Five 的 Arduino 那里得到任何反应,我们将不胜感激。
事实证明,问题是交叉兼容性问题。我使用 Git 在计算机之间同步文件和项目,一台计算机是 Mac,另一台计算机是 Windows。与许多其他 JavaScript 包不同,serialport 是一个特定于平台的包。所以,学着用gitignore吧。
希望这对其他人有帮助。