Skip to content

mechasolution/mpu6050test

Repository files navigation

MPU6050 driver for Android Things

This driver supports Invensense MPU6050 6 axis IMU sensor.

Datasheet
I2C register map

If you're Korean please visit our website check our AndroidThings Kit. we provide textbook and project code in github.

NOTE: these drivers are not production-ready. They are offered as sample implementations of Android Things user space drivers for common peripherals as part of the Developer Preview release. There is no guarantee of correctness, completeness or robustness.

How to use the driver

Gradle dependency

To use the mpu6050 driver, simply add the line below to your project's build.gradle. where matches the last version of the driver available on Jcenter.

dependencies {
    compile 'com.mechasolution:mpu6050:<version>'
}

Sample usage

import mechasolution.mpu6050.mpu6050;
  
mpu6050 mMpu = new mpu6050();
  
try {
    mMpu.open();
} catch ( IOException e ) { e.printStackTrace(); }
  
try {
    Log.i("Acel", String.format("%f \t %f \t %f", mMpu.getAccelX(), mMpu.getAccelY(), mMpu.getAccelZ()));
    Log.i("Temp", String.format("%f", mMpu.getTemp()));
    Log.i("Gyro", String.format("%f \t %f \t %f", mMpu.getGyroX(), mMpu.getGyroY(), mMpu.getGyroZ()));
} catch ( IOException e ) { e.printStackTrace(); }

License

Copyright 2017 Mechasolution

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages