wiegand-rfid-reader
v0.0.1
Published
JavaScript interface for wiegand readers on GPIO
Downloads
4
Readme
wiegand
A fork of node-wiegand for only 26bits wiegand readers on GPIO.
Tested with EM-18 Reader Module on a Raspberry Pi 3 model B.
installation
$ npm install --save wiegand-rfid-reader
#OR
$ npm install --save https://github.com/7aman/wiegand-rfid-reader.git
usage
const wiegand = require('wiegand-rfid-reader');
const reader = wiegand();
const Gpio = require('onoff').Gpio;
//export d0, d1 pins
const d0 = 17, d1 = 18;
const wgnd0 = new Gpio(d0, "in", "both");
const wgnd1 = new Gpio(d1, "in", "both");
reader.begin({ d0: d0, d1: d1});
reader.on('id', id => {
console.log('Got', id, 'from RFID reader');
});
reader.on('error', err => {
console.log(err);
});
process.on('SIGINT', () => {
wgnd0.unexport();
wgnd1.unexport();
});
api
class: Wiegand
inherits EventEmitter
method: begin([options], [callback])
default options:
{
// RaspberryPI default
d0: 17,
d1: 18,
}
callback
will fire on the ready
event or if an error happens during the process. Errors will be emited on the error
event.
method: stop([callback])
stop polling for changes to GPIO. Will callback when done and emit a stop
event.