Created
January 27, 2015 01:36
-
-
Save adkron/6271161299ff2be83d4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tessel = require('tessel'); | |
var rfidlib = require('rfid-pn532'); | |
var http = require('http'); | |
var querystring = require('querystring'); | |
var rfid = rfidlib.use(tessel.port['A']); | |
rfid.on('ready', function (version) { | |
console.log('Ready to read RFID card'); | |
rfid.on('data', function(card) { | |
var uid = card.uid.toString('hex') | |
console.log('UID:', uid); | |
//var params = querystring.stringify({ uid: uid }); | |
//var post_options = { | |
//host: 'Noggin', | |
//port: 4567, | |
//path: '/session/rfid', | |
//method: 'POST', | |
//headers: { | |
//'Content-Type': 'application/x-www-form-urlencoded', | |
//'Content-Length': params.length | |
//} | |
//}; | |
//var post_req = http.request(post_options, function(res) { | |
//res.setEncoding('utf8'); | |
//res.on('data', function (chunk) { | |
//console.log('Response: ' + chunk); | |
//}); | |
//}); | |
//post_req.write(params); | |
//post_req.end(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment