2017-02-16 17 views
0

에서 차단되었습니다.이 두 라이브러리를 사용하여 NFC 태그 (https://github.com/mitchellparsons/rc522-rfid-promise)를 검색하고 Raspberry Pi에서 MPD 서버 (https://github.com/andrewrk/mpd.js)를 제어하려고합니다. Raspbian Jessie (2017-01-11)에서 Node v6.9.5를 사용합니다.라이브러리의 콜백이 노드

다음 코드를 실행하면 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") 
}) 

고맙습니다! 오류 이벤트를 수신

답변

1

시도가 :

client.on('error', function (err) { 
    console.log('Error:', err) 
}); 
+0

오류 이벤트도 해고하지 않습니다. 이제 다른 라이브러리 (https://github.com/ocsacesar/rc522)를 사용하고 https://github.com/weixiyen/messenger.js를 통해 NFC 리더와 기본 로직을 분리했습니다. – Philluxx