kaihenzler / node-mcp23017

Node.js library for the I2C I/O Expander MCP23017 on a Raspberry Pi
MIT License
19 stars 28 forks source link

Fixed issue with closure #7

Closed jakorten closed 4 years ago

jakorten commented 4 years ago

If one calls digitalRead the result (read: side-effect) is that the pin number is mutated. It ended up to always become 16 in my case in the calling closure. I added an argument to the result (function(pin, err, value)) and copied the initial pin number in a let to make sure it will not be changed outside of the method itself. This also allowed me to solve an issue with another library for node-red that depends on this library.

kaihenzler commented 4 years ago

Thanks for the PR. I merged it and release version 0.0.5 to npm