完全按照这个演示。唯一的区别是我使用的是爱迪生而不是arduino。
这是我的服务器代码 app.js 。
var Cylon = require('cylon');
Cylon.robot({
name: 'chappie',
connections: {
edison: { adaptor: 'intel-iot' }//,
//led: { driver: 'led', pin: 13 }
},
devices: {
maxbotix: { driver: 'maxbotix', pin: '0' },
led: { driver: 'led', pin: 13 }
},
work: function (my) {
/*
STUFF TO DO!
*/
}
})
Cylon.api(
'socketio',
{
host: '0.0.0.0',//Is this correct??
port: '3000'
});
Cylon.start();
' blink-client'与演示中的完全相同,除了我将实际的IP硬编码到我们定义设备的爱迪生。即
device = io(' http://ip爱迪生:3000 / api / robots / chappie / devices / led');
当我运行app.js时,socketIO服务器正确启动,我看到了
[2015-02-17T20:04:12.813Z] INFO -- : Initializing connections.
[2015-02-17T20:04:13.116Z] INFO -- : Initializing devices.
[2015-02-17T20:04:14.646Z] INFO -- : Starting connections.
[2015-02-17T20:04:14.650Z] INFO -- : Starting devices.
[2015-02-17T20:04:14.667Z] INFO -- : Working.
[2015-02-17T20:04:14.703Z] INFO -- : Cylon API Server is now online.
[2015-02-17T20:04:14.704Z] INFO -- : Listening at https://127.0.0.1:3000
但是当我尝试在同一网络上的PC上的浏览器中运行blink-client.html时,我得到 ERR_CONNECTION_REFUSED
我使用的是cylon-api-socketio 版本" 0.2.2" 和nodejs 版本0.10.28 。
如果我只是去浏览器中的客户端PC中
http://actual ip of edison
我正确地看到爱迪生的默认页面显示我有正确的IP并且我的app.js正在运行。
我真的不确定我的下一个调试步骤应该是什么。任何帮助表示赞赏!