MPU9250 accelerometer/gyro/magnetometer

The Invensense MPU9250 is a 9-axis Motion Processing Unit, containing a gyro, magnetometer and accelerometer. This module enables I2C communication with the chip to easily get acceleration and rotation data. Use the MPU9250 (About Modules) module for it.

Note: Sensor fusion is currently not supported by this library - so only raw x,y,z readings are returned.

Basic usage:

I2C1.setup({scl:B6,sda:B7});
mpu = require("MPU9250").connectI2C(I2C1);
mpu.samplerate = 10; // Hz - default is 200
setWatch(function(){
  // get {x,y,z} for all 3 sensors - { accel, gyro, mag }
  var data = mpu.read();
}, MPU_IRQ, {repeat:true, edge:"rising"});
// init after a delay
setTimeout(function() {
  mpu.initMPU9250();
}, 10);

Reference

MPU9250.prototype.calibrateMPU9250 = function () { ... }

MPU9250.prototype.initMPU9250 = function () { ... }

MPU9250.prototype.dataReady = function () { ... }

// return {x,y,z} for the accelerometer - in G
MPU9250.prototype.readAccel = function () { ... }

// return {x,y,z} for the gyro in degrees/second
MPU9250.prototype.readGyro = function () { ... }

// return {x,y,z} for the magnetometer in millGaus
MPU9250.prototype.readMag = function () { ... }

// return {x,y,z} for all 3 sensors - { accel, gyro, mag }
MPU9250.prototype.read = function () { ... }

// Initialise the MPU9250 module with the given I2C interface
exports.connectI2C = function (i2c, options) { ... }

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.