Skip to content

Instantly share code, notes, and snippets.

@adkron adkron/index.js
Created Jan 27, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.