diff --git a/lib/mcp23008-17.js b/lib/mcp23008-17.js index 0673d6e..2ed4a2f 100644 --- a/lib/mcp23008-17.js +++ b/lib/mcp23008-17.js @@ -13,9 +13,12 @@ class MCP23008 extends Device { this.ports = {} opts.portID = 'A' this.ports.A = new Port(opts) + console.log(this.ports.A) // if not specified there RPi is not managing the interrupt // pin number on RPi that is connected to and services the interrupt. 4/17/27/22 = 7/11/13/15 - this.ports.A.interPin = opts.interPin.A ? opts.interPin.A : opts.interPin + if (opts.interPin) { + this.ports.A.interPin = opts.interPin.A ? opts.interPin.A : opts.interPin + } } // end constructor init() { @@ -132,7 +135,9 @@ class MCP23017 extends MCP23008 { // add a second port opts.portID = 'B' this.ports.B = new Port(opts) - this.ports.B.interPin = opts.interPin.B ? opts.interPin.B : opts.interPin + if (opts.interPin) { + this.ports.B.interPin = opts.interPin.B ? opts.interPin.B : opts.interPin + } } pin(id, port) {