index.js
function RotaryEncoder(pinA, pinB) {
	this.gpioA = new Gpio(pinA, 'in', 'both');
	this.gpioB = new Gpio(pinB, 'in', 'both');

	this.a = 2;
	this.b = 2;

	this.gpioA.watch((err, value) => {
		if (err) {
			this.emit('error', err);

			return;
		}

		this.a = value;
	});

	this.gpioB.watch((err, value) => {
		if (err) {
			this.emit('error', err);

			return;
		}

		this.b = value;

		this.tick();
	});
}
function RotaryEncoder(pinA, pinB) {
	this.gpioA = new Gpio(pinA, 'in', 'both');
	this.gpioB = new Gpio(pinB, 'in', 'both');

	this.a = 2;
	this.b = 2;

	this.gpioA.watch((err, value) => {
		if (err) {
			this.emit('error', err);

			return;
		}

		this.a = value;
	});

	this.gpioB.watch((err, value) => {
		if (err) {
			this.emit('error', err);

			return;
		}

		this.b = value;

		this.tick();
	});
}
function RotaryEncoder ( pinA , pinB ) { this . gpioA = new Gpio ( pinA , 'in' , 'both' ) ; this . gpioB = new Gpio ( pinB , 'in' , 'both' ) ; this . a = 2 ; this . b = 2 ; this . gpioA . watch ( ( err , value ) => { if ( err ) { this . emit ( 'error' , err ) ; return ; } this . a = value ; } ) ; this . gpioB . watch ( ( err , value ) => { if ( err ) { this . emit ( 'error' , err ) ; return ; } this . b = value ; this . tick ( ) ; } ) ; }
Creates a new Rotary Encoder using two GPIO pins
Expects the pins to be configured as pull-up

@param pinA GPIO # of the first pin
@param pinB GPIO # of the second pin

@returns EventEmitter
Creates a new Rotary Encoder using two GPIO pins Expects the pins to be configured as pull - up