How to use the i2c-bus.open function in i2c-bus

To help you get started, we’ve selected a few i2c-bus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shekit / peeqo-robot / electron / app / js / commands / i2c-cmds.js View on Github external
var i2c1 = null

if(process.platform != 'darwin'){
	// doesnt work on mac, so conditional to run on pi

	const i2cBus = require('i2c-bus')

	i2c1 = i2cBus.open(1, function(err){
		if(err){
			console.log("i2c error: "+err )
		} else {
			console.log("I2C OPEN")
		}
	})
}

module.exports = function(){

	var i2c = {}

	i2c.sendByte = function(addr, cmd, byte) {
		if(i2c1){
			i2c1.writeByte(addr, cmd, byte, function(){})
		}
github alexellis / scroll-phat-node / src / scroll.js View on Github external
fs.readFile(path.join(__dirname, './font.json'), 'utf8', function(err, text) {
		if(err) { 
			return done(err);
		}

		that.font = JSON.parse(text);

		that.wire = i2c.open(1, function(err) {
			that.wire.writeByte(i2c_address, cmd_set_mode, parseInt(mode_5x11, 2), function(){
				done(err);
			});
		});
	});
};
github fivdi / i2c-bus / example / MCP9808-async.js View on Github external
function (cb) {
      i2c1 = i2c.open(I2C_CONTROLLER_NAME, cb);
    },
    function (cb) {

i2c-bus

I2C serial bus access with Node.js

MIT
Latest version published 12 months ago

Package Health Score

58 / 100
Full package analysis

Popular i2c-bus functions