我正在尝试使用johnny-five模块在Windows 8.1和Node.js的USB上的esp8266上运行simled led闪烁。
我已经按照本教程https://boneskull.com/how-to-use-an-esp8266-with-johnny-five/进行操作,并且能够通过wifi连接执行所需的任务。
从Arduino IDE上传StandardFirmataWifi示例后,此代码将起作用:
const { EtherPortClient } = require('etherport-client');
const five = require('johnny-five');
const board = new five.Board({
port: new EtherPortClient({
host: '192.168.1.113',
port: 3030
})
});
board.on('ready', () => {
var led = new five.Led(2);
// "blink" the led in 500ms
// on-off phase periods
led.blink(500);
});
但是,当我尝试使用usb连接而不是wifi使用以下代码运行相同的代码时:
const { EtherPortClient } = require('etherport-client');
const five = require('johnny-five');
const board = new five.Board();
board.on('ready', () => {
var led = new five.Led(2);
// "blink" the led in 500ms
// on-off phase periods
led.blink(500);
});
它输出下一个错误:
Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooti
ng
If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the b
oard, wait approximately 11 seconds for complete reset, then run your program ag
ain.
PS:当我通过USB从Arduino IDE加载草图时,它可以完美工作,所以我认为问题在于某些节点配置。
在此先感谢您的帮助!