Skip to content

jkutianski/node-i2c

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published