Mpu6050 Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
MPU6050 - gyroscope, accelerometer and temperature sensor
[System.Device.Model.Interface("MPU6050 - gyroscope, accelerometer and temperature sensor")]
public class Mpu6050 : IDisposable
[<System.Device.Model.Interface("MPU6050 - gyroscope, accelerometer and temperature sensor")>]
type Mpu6050 = class
interface IDisposable
Public Class Mpu6050
Implements IDisposable
- Inheritance
-
Mpu6050
- Derived
- Attributes
- Implements
Constructors
Mpu6050(I2cDevice) |
Initialize the MPU6050 |
Fields
DefaultI2cAddress |
Default address for MPU9250 |
SecondI2cAddress |
Second address for MPU9250 |
Properties
AccelerationScale |
Get the real accelerometer bandwidth. This allows to calculate the real degree per second |
AccelerometerBandwidth |
Get or set the accelerometer bandwidth |
AccelerometerBias |
Accelerometer bias data |
AccelerometerLowPowerFrequency |
Set or get the accelerometer low power mode |
AccelerometerRange |
Get or set the accelerometer range |
DisableModes |
Get or set the elements to disable. It can be any axes of the accelerometer and or the gyroscope |
FifoCount |
Get the number of elements to read from the FIFO (First In First Out) buffer |
FifoModes |
Get or set the FIFO (First In First Out) modes |
GyroscopeBandwidth |
Get or set the gyroscope bandwidth |
GyroscopeBias |
Gyroscope bias data |
GyroscopeRange |
Get or set the gyroscope range |
GyroscopeScale |
Get the real gyroscope bandwidth. This allows to calculate the real angular rate in degree per second |
SampleRateDivider |
Get or set the sample diver mode |
Methods
CalibrateGyroscopeAccelerometer() |
Perform full calibration the gyroscope and the accelerometer It will automatically adjust as well the offset stored in the device The result bias will be stored in the AcceloremeterBias and GyroscopeBias |
Dispose() |
Cleanup everything |
GetAccelerometer() |
Get the accelerometer in G |
GetGyroscopeReading() |
Get the gyroscope in degrees per seconds |
GetTemperature() |
Get the temperature |
ReadByteFromReplicaDevice(I2cChannel, Byte, Byte, Span<Byte>) |
Read data from any of the I2C replica attached to the MPU9250 |
ReadFifo(Span<Byte>) |
Read data in the FIFO (First In First Out) buffer, read as many data as the size of readData byte span You should read the number of data available in the FifoCount property then read them here. You will read only data you have selected in FifoModes. Data are in the order of the Register from 0x3B to 0x60. ACCEL_XOUT_H and ACCEL_XOUT_L ACCEL_YOUT_H and ACCEL_YOUT_L ACCEL_ZOUT_H and ACCEL_ZOUT_L TEMP_OUT_H and TEMP_OUT_L GYRO_XOUT_H and GYRO_XOUT_L GYRO_YOUT_H and GYRO_YOUT_L GYRO_ZOUT_H and GYRO_ZOUT_L EXT_SENS_DATA_00 to EXT_SENS_DATA_24 |
SetWakeOnMotion(UInt32, AccelerometerLowPowerFrequency) |
Setup the Wake On Motion. This mode generate a rising signal on pin INT You can catch it with a normal GPIO and place an interruption on it if supported Reading the sensor won't give any value until it wakes up periodically Only Accelerator data is available in this mode |
WriteByteToReplicaDevice(I2cChannel, Byte, Byte, Byte) |
Write data on any of the I2C replica attached to the MPU9250 |
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for