accel-mma84

Library to run the MMA8452Q accelerometer.

npm install accel-mma84
19 downloads in the last week
35 downloads in the last month

Accelerometer

Driver for the accel-mma84 Tessel accelerometer module (MMA8452Q).

Installation

npm install accel-mma84

Example

// var hardware = require('hardware');
var tessel = require('tessel');
console.log("Connecting to accelerometer on port bank A");
var accel = require('accel-mma84').connect(tessel.port("A"));

// Initialize the accelerometer.
accel.on('connected', function () {
  // Loop forever.
  setInterval(function () {
    accel.getAcceleration(function (err, xyz) {
      console.log("x:", xyz[0].toFixed(2),
        "y:", xyz[1].toFixed(2),
        "z:", xyz[2].toFixed(2));
    });
  }, 100);
});

Methods

  • accel.initialize()

  • accel.getAcceleration(callback(err, xyz))

Events

  • connected

  • data

Further Examples

License

MIT

npm loves you