2015-09-22 19:15:58 +03:00
|
|
|
/*
|
|
|
|
|
* Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
|
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2015-09-22 19:15:58 +03:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2015-09-22 19:15:58 +03:00
|
|
|
*/
|
|
|
|
|
|
2018-08-07 17:12:08 +03:00
|
|
|
import java.util.AbstractList;
|
|
|
|
|
|
2015-09-22 19:15:58 +03:00
|
|
|
//NOT TESTED!!!
|
2018-02-27 12:12:09 -08:00
|
|
|
public class MPU9150_Example {
|
2015-09-22 19:15:58 +03:00
|
|
|
|
|
|
|
|
public static void main(String[] args) throws InterruptedException {
|
2015-10-08 14:30:12 +03:00
|
|
|
// ! [Interesting]
|
2015-09-22 19:15:58 +03:00
|
|
|
upm_mpu9150.MPU9150 sensor = new upm_mpu9150.MPU9150();
|
2015-10-08 14:30:12 +03:00
|
|
|
|
2015-09-22 19:15:58 +03:00
|
|
|
sensor.init();
|
2015-10-08 14:30:12 +03:00
|
|
|
|
|
|
|
|
while (true) {
|
2015-09-22 19:15:58 +03:00
|
|
|
sensor.update();
|
2015-10-08 14:30:12 +03:00
|
|
|
|
2017-02-07 17:00:29 -08:00
|
|
|
// These don't exist
|
|
|
|
|
// float[] accel = sensor.getAccelerometer();
|
|
|
|
|
// System.out.println("Accelerometer: " + "AX: " + accel[0] + " AY: " + accel[1] + " AZ: "
|
|
|
|
|
// + accel[2]);
|
|
|
|
|
//
|
|
|
|
|
// float[] gyro = sensor.getGyroscope();
|
|
|
|
|
// System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
|
|
|
|
|
// + gyro[2]);
|
2015-10-08 14:30:12 +03:00
|
|
|
|
2018-08-07 17:12:08 +03:00
|
|
|
AbstractList<Float> magn = sensor.getMagnetometer();
|
2018-01-23 11:58:12 -08:00
|
|
|
System.out.println("Magnetometer: " + "MX: " + magn.get(0) + " MY: " + magn.get(1) + " MZ: " + magn.get(2));
|
2015-10-08 14:30:12 +03:00
|
|
|
|
2015-09-22 19:15:58 +03:00
|
|
|
Thread.sleep(1000);
|
|
|
|
|
}
|
2015-10-08 14:30:12 +03:00
|
|
|
// ! [Interesting]
|
2015-09-22 19:15:58 +03:00
|
|
|
}
|
2017-02-07 17:00:29 -08:00
|
|
|
}
|