UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

MPU9150 Class

Module: mpu9150

This module defines the MPU9150 interface for libmpu9150
mpu9150.jpg

Methods

MPU9150

(
  • bus
  • address
  • magAddress
  • enableAk8975
)
Number

MPU9150 constructor

Parameters:

  • bus Number

    I2C bus to use

  • address Number

    The address for this device

  • magAddress Number

    The address of the connected magnetometer

  • enableAk8975 Boolean

    Enables i2c bypass mode for magnetometer, default is true

Returns:

Number:

init

() Boolean

Set up initial values and start operation

Returns:

Boolean:

true if successful

update

()

Take a measurement and store the current sensor values internally. Note, these user facing registers are only updated from the internal device sensor values when the i2c serial traffic is 'idle'. So, if you are reading the values too fast, the bus may never be idle, and you will just end up reading the same values over and over.
Unfortunately, it is is not clear how long 'idle' actually means, so if you see this behavior, reduce the rate at which you are calling update() .

getMagnetometer

(
  • x
  • y
  • z
)

Return the compensated values for the x, y, and z axes. The unit of measurement is in micro-teslas (uT).

Parameters:

  • x Float *

    Pointer to returned X axis value

  • y Float *

    Pointer to returned Y axis value

  • z Float *

    Pointer to returned Z axis value

getMagnetometer

() Std::vector float

Return the compensated values for the x, y, and z axes. The unit of measurement is in micro-teslas (uT).

Returns:

Std::vector float :

std::vector containing X, Y, Z magnetometer values