upm/examples/java/A110xSample.java
Stefan Andritoiu 2595c0b623 java: added examples and solved some issues with the naming convention
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2015-09-04 13:49:21 -07:00

25 lines
529 B
Java

public class A110xSample {
static {
try {
System.loadLibrary("javaupm_a110x");
} catch (UnsatisfiedLinkError e) {
System.err.println("error in loading native library");
System.exit(-1);
}
}
public static void main(String argv[]) throws InterruptedException {
upm_a110x.A110X a110x = new upm_a110x.A110X(2);
while(true) {
if(a110x.magnetDetected()) {
System.out.println("magnet detected...");
}
else {
System.out.println("magnet not detected...");
}
Thread.sleep(1000);
}
}
}