Windows 10, Arduino Micro. I was originally using the standard "Blink.js" tutorial, but Johnny-Five kept connecting to the wrong serial port. 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. 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. 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.
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. Unlike many other JavaScript packages, serialport is a package which is platform specific. So, learn to use gitignore.
Hope this helps other people.