node.js - 约翰尼五世蓝牙连接问题

标签 node.js bluetooth arduino arduino-uno johnny-five

我想使用 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/

相关文章:

node.js - 如何使用 Jest 模式匹配在一个文件夹中调用所有测试?

javascript - Mongoose 找到下一个对象

javascript - 使用 Node.js 将 createWriteStream txt 内容写入全局变量

iphone - 从 View 1 切换到蓝牙设置......不可能吗?

c - 我怎样才能最小化这个程序的代码大小?

matlab - Arduino 和 Matlab 之间串行同步数据传输

node.js - nodejs - 如何更改文件的创建时间

android - 蓝牙 Bluez : Unable to create crypto contex

android - 在 Android 中读取 BLE 接近配置文件的蓝牙 RSSI

c# - 连续读取和解析串行数据的快速方法