I would like to ask you if you could help me with my code.
I am trying for almost 4 hours now, and think I am slowly going insane. :)
The problem I got is that I get the 'possible eventemitter memory leak detected' error after I write 10 times to the i2c device.
I got this code:
function write2address(address, hex) {
wire = new i2c(address, {device: '/dev/i2c-0'});
wire.writeByte(hex, function(err) {});
}
Now, I call this code each time I want to write something.
I guess this is not ok, and I would need to instantiate the wire var only once and apply the writeByte method on this. The problem is that my addresses are coming from a database. So they need to be dynamic.
This is what I also tried:
var wires = {};
_.each(addresses, function(address) {
wires[address] = new i2c(address, {device: '/dev/i2c-0'});
});
function write2address(address, hex) {
wires[address].writeByte(hex, function(err) {});
}
When I call my write2address function, I get 'Cannot write to device' as error.
I know this is a shortcoming on my programming skills, but it appears no one can or wants to help me out on IRC or at the local hackerspace. I would love it if you could help me with this.
Hey!
I would like to ask you if you could help me with my code. I am trying for almost 4 hours now, and think I am slowly going insane. :)
The problem I got is that I get the 'possible eventemitter memory leak detected' error after I write 10 times to the i2c device.
I got this code:
Now, I call this code each time I want to write something. I guess this is not ok, and I would need to instantiate the wire var only once and apply the writeByte method on this. The problem is that my addresses are coming from a database. So they need to be dynamic.
This is what I also tried:
When I call my write2address function, I get 'Cannot write to device' as error.
I know this is a shortcoming on my programming skills, but it appears no one can or wants to help me out on IRC or at the local hackerspace. I would love it if you could help me with this.
Cheers, Tom