Table of Contents

Class Mpu6886AccelerometerGyroscope

Namespace
Iot.Device.Mpu6886
Assembly
Iot.Device.Mpu6886.dll

Mpu6886 accelerometer and gyroscope

[Interface("Mpu6886 accelerometer and gyroscope")]
public class Mpu6886AccelerometerGyroscope
Inheritance
Mpu6886AccelerometerGyroscope

Constructors

Mpu6886AccelerometerGyroscope(I2cDevice)

Mpu6886 - Accelerometer and Gyroscope bus

public Mpu6886AccelerometerGyroscope(I2cDevice i2cDevice)

Parameters

i2cDevice I2cDevice

Fields

DefaultI2cAddress

The default I2C address for the MPU6886 sensor. (Datasheet page 49) Mind that the address can be configured as well for 0x69 depending upon the value driven on AD0 pin.

public const int DefaultI2cAddress = 104

Field Value

int

SecondaryI2cAddress

The secondary I2C address for the MPU6886 sensor. (Datasheet page 49)

public const int SecondaryI2cAddress = 105

Field Value

int

Properties

AccelerometerInterruptEnabled

The axes on which the interrupt should be enabled.

public InterruptEnable AccelerometerInterruptEnabled { get; set; }

Property Value

InterruptEnable

AccelerometerLowPowerMode

Gets and sets the averaging filter settings for low power accelerometer mode. (Datasheet page 37)

public AccelerometerLowPowerMode AccelerometerLowPowerMode { get; set; }

Property Value

AccelerometerLowPowerMode

AccelerometerScale

Gets and sets the accelerometer full scale. (Datasheet page 37)

public AccelerometerScale AccelerometerScale { get; set; }

Property Value

AccelerometerScale

EnabledAxes

Sets the enabled axes of the gyroscope and accelerometer. (Datasheet page 47)

public EnabledAxis EnabledAxes { get; set; }

Property Value

EnabledAxis

GyroscopeOffset

Gets and sets the gyroscope offset in the GyroscopeOffsetAdjustment registers of the MPU6886. Setting the offset can be usefull when a custom callibration calculation is used, instead of the Calibrate function of this class.

public Vector3 GyroscopeOffset { get; set; }

Property Value

Vector3

GyroscopeScale

Gets and sets the gyroscope full scale. (Datasheet page 37)

public GyroscopeScale GyroscopeScale { get; set; }

Property Value

GyroscopeScale

SampleRateDivider

Divides the internal sample rate (see register CONFIG) to generate the sample rate that controls sensor data output rate, FIFO sample rate. (Datasheet page 35)

public byte SampleRateDivider { get; set; }

Property Value

byte

Methods

Calibrate(int)

Calibrate the gyroscope by calculating the offset values and storing them in the GyroscopeOffsetAdjustment registers of the MPU6886.

public Vector3 Calibrate(int iterations)

Parameters

iterations int

The number of sample gyroscope values to read

Returns

Vector3

The calulated offset vector

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetAccelerometer()

Reads the current accelerometer values from the registers, and compensates them with the accelerometer resolution.

public Vector3 GetAccelerometer()

Returns

Vector3

Vector of acceleration

GetGyroscope()

Reads the current gyroscope values from the registers, and compensates them with the gyroscope resolution.

public Vector3 GetGyroscope()

Returns

Vector3

Vector of the rotation

GetInternalTemperature()

Reads the register of the on-chip temperature sensor which represents the MPU-6886 die temperature.

public Temperature GetInternalTemperature()

Returns

Temperature

Temperature in degrees Celcius

Reset()

Reset the internal registers and restores the default settings. (Datasheet, page 47)

public void Reset()

Sleep()

Set the chip to sleep mode. (Datasheet, page 47)

public void Sleep()

WakeUp()

Disables the sleep mode. (Datasheet, page 47)

public void WakeUp()