Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem talking to multiple i2c devices #7

Open
mofux opened this issue May 22, 2013 · 8 comments
Open

Problem talking to multiple i2c devices #7

mofux opened this issue May 22, 2013 · 8 comments
Assignees
Labels

Comments

@mofux
Copy link

mofux commented May 22, 2013

Hi,

after the update the i2c address has to be passed to the constructor when initialising a new i2c device. Unfortunately this does not account for talking to multiple i2c devices:

var i2c = require('i2c');
var device1 = new i2c(0x5, {device: '/dev/i2c-0', debug: false});
// imagine device 1 would always return 1 if I read a byte and device 2 would always return 2
device1.readByte(console.log);   // result: 1
var device2 = new i2c(0x6, {device: '/dev/i2c-0', debug: false});
device2.readByte(console.log);   // result: 2
device1.readByte(console.log);   // result: 2 <-- wrong, should be 1

Is this behaviour intended? If so, what would be the correct way to change the i2c address after initialisation?

@kelly
Copy link
Owner

kelly commented May 22, 2013

There is a setAddress method, but I'll change it so that it sets the address before each read and write request. I'll get that in the next version.

@ghost ghost assigned kelly May 22, 2013
@kelly kelly closed this as completed May 23, 2013
@mofux
Copy link
Author

mofux commented May 23, 2013

I have tested with the new version but the problem still exists. I can see the changes in the i2c.cc file but it doesn't seem to change the address properly. If I do wire.setAddress(..) it is working okay.

@kelly
Copy link
Owner

kelly commented May 23, 2013

Will try a few more things and get a new release out soon.

@kelly kelly reopened this May 23, 2013
@kelly
Copy link
Owner

kelly commented Jun 4, 2013

Maybe fixed now? Still haven't had a chance to test.

@MrYsLab
Copy link

MrYsLab commented Dec 14, 2014

Has the latest version been verified to support multiple simultaneous i2c devices?

@alexdmejias
Copy link

is there an update to this?

@phixMe
Copy link

phixMe commented Apr 18, 2016

I am having similar issues.
I get a memory leak if I try this:

var device1 = new i2c(0x70, {device: '/dev/i2c-1', debug: false});
var device2 = new i2c(0x70, {device: '/dev/i2c-6', debug: false});

Has anybody had trouble with this?

@phixMe
Copy link

phixMe commented May 18, 2016

I am still having a show stopping bug related to this.

Here is my error:
ERROR: (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
ERROR: Trace
at process.addListener (events.js:160:15)
at process.on.process.addListener (node.js:802:26)
at new i2c (/home/root/.node_app_slot/node_modules/node-BNO055/node_modules/i2c/lib/i2c.coffee:34:15)

Thanks for looking, any suggestions would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants