Bindings for i2c-dev lib. Plays well with Raspberry Pi.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 44 commits behind kelly:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
src
.gitignore
README.md
binding.gyp
main.js
package.json

README.md

i2c

Bindings for i2c-dev lib. Plays well with Raspberry Pi.

Install

$ npm install i2c

Usage

var i2c = require('i2c');
var wire = new i2c('/dev/i2c-0', debug: true); // point to your i2c device, debug provides REPL interface
var address = 0x18;

wire.scan(function(err, data) {
  // result contains an array of addresses
});

wire.write(address, [byte0, byte1], function(err) {});

wire.read(address, length, function(err, data) {
  // result contains an array of bytes
});

wire.stream(address, command, length, delay); // continuous stream 
wire.on('data', function(data) {
  // result for continuous stream contains data array, address, timestamp
});

Raspberry Pi Setup

$ sudo vi /etc/modprobe.d/raspi-blacklist.conf

Comment out blacklist i2c-bcm2708

#blacklist i2c-bcm2708

Load kernel module

$ modprobe i2c-bcm2708

Wiring Example

to-do

Questions?

@korevec on twitter