mirror of
https://github.com/eclipse/upm.git
synced 2025-03-22 16:37:29 +03:00

Signed-off-by: Andrei Vasiliu <andrei.vasiliu@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
30 lines
863 B
Java
30 lines
863 B
Java
public class Adxl345 {
|
|
static {
|
|
try {
|
|
System.loadLibrary("javaupm_adxl345");
|
|
} catch (UnsatisfiedLinkError e) {
|
|
System.err.println("error in loading native library");
|
|
System.exit(-1);
|
|
}
|
|
}
|
|
|
|
public static void main(String argv[]) throws InterruptedException {
|
|
upm_adxl345.Adxl345 obj = new upm_adxl345.Adxl345(0);
|
|
int[] raw = new int[3];
|
|
float[] accel = new float[3];
|
|
|
|
while (true) {
|
|
obj.update();
|
|
raw = obj.getRawValues();
|
|
accel = obj.getAcceleration();
|
|
|
|
System.out.println("raw data: " + raw[0] + " " + raw[1] + " " +
|
|
raw[2]);
|
|
System.out.println("accel data: " + accel[0] + " " + accel[1] + " "
|
|
+ accel[2]);
|
|
|
|
Thread.sleep(1000);
|
|
}
|
|
}
|
|
}
|