我想使用 JS/Johnny-Five 以无线方式从我的计算机向 Arduino 运行命令。 我有一个 Uno 和一个 HC-05。我按照说明设置了 HC-05 in this URL .我可以将我的电脑与它配对,并且我已经将 StandardFirmata 上传到 Uno。 但是当我尝试与它通信时它似乎超时了。
当我输入时,通过 NodeJS 命令行
> var five = require("johnny-five");
> var board = new five.Board({repl: false, port:'/dev/cu.ailaGduino-DevB'})
我得到:
1480635008609 Connected /dev/cu.ailaGduino-DevB
undefined
> 1480635018633 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
稍后提到 Timer.listOnTimeout 作为错误调用堆栈的一部分。
Arduino IDE 会在配对时列出该特定设备,我想这就是它显示“已连接”的原因。
当我再次尝试相同的命令时,我得到了
> var board = new five.Board({port:'/dev/cu.ailaGduino-DevB'})
1480635041136 Connected /dev/cu.ailaGduino-DevB
undefined
> 1480635041138 Error Error Resource temporarily unavailable Cannot lock port
通过 USB 没问题。
有什么想法吗?
最佳答案
我认为这一点是错误的,因为您寻址的是本地连接的设备而不是 wifi 连接的设备。
var board = new five.Board({port:'/dev/cu.ailaGduino-DevB'})
This tut建议您需要以不同的方式连接到电路板。
var EtherPortClient = require("etherport-client").EtherPortClient;
var board = new five.Board({
port: new EtherPortClient({
host: "xxx.xxx.xxx.xxx", // IP ESP8266
port: 3030
}),
timeout: 10000,
repl: false
});
关于node.js - 约翰尼五世蓝牙连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40923908/