kaihenzler / node-mcp23017 Goto Github PK
View Code? Open in Web Editor NEWNode.js library for the I2C I/O Expander MCP23017 on a Raspberry Pi
License: MIT License
Node.js library for the I2C I/O Expander MCP23017 on a Raspberry Pi
License: MIT License
Hi, I'm just having a go with the example javascript and wondered if the line:
var MCP23017 = require('mcp23017');
Is actually supposed to be require('node-mcp23017') ?
It would explain the problem I've been having of it not finding the module named 'mcp23017'
Hi,
i'm getting an error at compilation with > node-gyp rebuild
Can you help ?
i2c.target.mk:90: recipe for target 'Release/obj.target/i2c/src/i2c.o' failed
make: *** [Release/obj.target/i2c/src/i2c.o] Error 1
make: Leaving directory '/home/pi/nodeserver/node_modules/i2c/build'
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.50-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/nodeserver/node_modules/i2c
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/nodeserver/package.json'
npm WARN nodeserver No description
npm WARN nodeserver No repository field.
npm WARN nodeserver No README data
npm WARN nodeserver No license field.
npm ERR! Linux 4.4.50-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "node-mcp23017" "--save"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the i2c package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs i2c
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls i2c
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/nodeserver/npm-debug.log
Unfortunately, it seems that a variable is no longer defined, because everything still works in version 0.0.2.
I get the following error:
/node_modules/node-mcp23017/lib/mcp23017.js:136
this._send(register, [registerDir]);
I am using node 8.11.1
The operating system is the latest version of RASPBIAN STRETCH.
Hi,
First of all, thank you for writing this module.
I was wondering if you'd be happy for me to port this to ES6 (mainly using const
and native classes). This will make the code more modern and easier to maintain in the longer term.
Please let me know if you'd accept a PR for it.
Merc.
Hi there, thanks for the work on this library, I think there have been some changes to the API that we find in the readme which need to be changed to reflect the new one:
var mcp = new MCP23017({
address: 0x20, //default: 0x20
device: '/dev/i2c-1', // '/dev/i2c-1' on model B | '/dev/i2c-0' on model A
debug: true //default: false
});
should be
var mcp = new MCP23017({
address: 0x20, //default: 0x20
device: 1, // 1 for '/dev/i2c-1' on model B | 0 for '/dev/i2c-0' on model A ////// this field accepts only numbers now in i2c-bus
debug: true //default: false
});
and
mcp.digitalRead(0, function (err, value) {
console.log('Pin 0', value);
});
should be
/////// There is the addition of a new first argument for .prototype.digitalRead()
mcp.digitalRead(0, function (pin, err, value) {
console.log('Pin 0', value);
});
I'm happy to submit a PR for this if this sounds good to you. Thanks again for sharing this!
Hello people.
i've a number of sensors (like HC-SR04), i'm trying put them under a mcp23017 so i can use them in parallel.
The original code used pigpio
https://github.com/fivdi/pigpio/blob/master/doc/gpio.md#event-alert
Especially i need to use "Gpio.INPUT, alert: true" and the "on alert" event ( .on('alert', (level, tick) => {})
to send a pulse via a channel and see the time to calculate distance.
I know node-mcp23017 uses i2c-bus. So, is there a way to substitute the alert event with the bus.receiveByte(addr, cb) function?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.