shokai / node-arduino-firmata

Arduino Firmata protocol implementation on Node.js
https://npmjs.org/package/arduino-firmata
MIT License
51 stars 20 forks source link

reading i2c protocoll #17

Open adrianardu opened 8 years ago

adrianardu commented 8 years ago

Hi,

How can I read I2C signals with node? The Led examples works fine, but I have problems how to access the I2C functions of firmata with node. Is sysex the only way? And how it would look? I tried: "arduino.sysec(I2C_CONFIG, [?], [?, I2C_READ, ?])" unfortunetly I don't know if its correct way and which parameters I can use?

Thanks -Adrian

devbobo commented 8 years ago

I initally wanted to do this but in the end went with another node module for I2C, but I need to be able to config the i2C bus before it was able to be used.

Using the node-firmata code I was able to work out the sysex call to do this...

const I2C_CONFIG = 0x78;

arduino.sysex(I2C_CONFIG, [0 & 0xFF, (0 >> 8) & 0xFF]);

Hopefully, this might be a starting point if you still want to do this.

Cheers,

David