简体   繁体   English

Johnny-5无法连接到Arduino

[英]Johnny-Five Unable to Connect to Arduino

Windows 10, Arduino Micro. Windows 10,Arduino Micro。 I was originally using the standard "Blink.js" tutorial, but Johnny-Five kept connecting to the wrong serial port. 我最初使用的是标准的“ Blink.js”教程,但是Johnny-Five一直连接到错误的串行端口。 I hard-coded my COM port (port 8, in this case), and got past the initial error, but a new one has stopped me dead. 我对我的COM端口(在本例中为端口8)进行了硬编码,并且超过了最初的错误,但是新的错误使我死了。 My output looks like this: 我的输出如下所示:

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)

I've done all of the obvious things they recommend: re-flashing the firmware, burn the bootloader, re-install node and npm, gone step-by-step through the installation instructions for the Arduino, although I had to push the standardFirmataPlus.ino via the GUI instead of the command line, as Windows does not natively include command line tools for Arduino. 我已经完成了他们建议的所有显而易见的操作:重新刷新固件,刻录引导程序,重新安装节点和npm,逐步完成了Arduino的安装说明,尽管我不得不推动标准的FirmataPlus。 .ino通过GUI而不是通过命令行,因为Windows本身不包含用于Arduino的命令行工具。 My code, if it makes any difference, looks like this: 我的代码(如果有什么不同)看起来像这样:

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);
});

I've been struggling for ages to get any reaction from an Arduino using Johnny-Five, and any help would be greatly appreciated. 我一直在努力争取使用Johnny-Five从Arduino得到任何反应,任何帮助将不胜感激。

As it turns out, the issue was a problem with cross-compatibility. 事实证明,这个问题是交叉兼容性的问题。 I was using Git to sync files and projects between computers, one computer being Mac, the other being Windows. 我使用Git在计算机之间同步文件和项目,一台计算机是Mac,另一台是Windows。 Unlike many other JavaScript packages, serialport is a package which is platform specific. 与许多其他JavaScript软件包不同,serialport是特定于平台的软件包。 So, learn to use gitignore. 因此,学习使用gitignore。

Hope this helps other people. 希望这对其他人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM