0
我尝试使用这两个库以检测NFC标签(https://github.com/mitchellparsons/rc522-rfid-promise),并控制上的树莓裨一个MPD服务器(https://github.com/andrewrk/mpd.js)。我在Raspbian Jessie上使用Node v6.9.5(2017-01-11)。回调库都阻断节点
当执行下面的代码仅执行MPD监听器。有没有我做错了或误解了Nodejs的概念?
var mpd = require('mpd')
var rc522 = require("rc522-rfid-promise")
var client = mpd.connect({
port: 6600,
host: 'localhost',
})
rc522.startListening()
.then(function(rfidTag){
console.log('Got RFID tag')
})
client.on('ready', function() {
console.log("MPD ready")
})
谢谢!
错误事件不会解雇了。我现在使用另一个库(https://github.com/ocsacesar/rc522),并通过https://github.com/weixiyen/messenger.js解耦NFC阅读器和主逻辑 – Philluxx