mirror of
https://github.com/eclipse/upm.git
synced 2025-07-27 14:11:15 +03:00
Added some examples for Java
Signed-off-by: Andrei Vasiliu <andrei.vasiliu@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
7e2ae96c1f
commit
8b0d1b2b3d
24
examples/java/A110x_ex.java
Normal file
24
examples/java/A110x_ex.java
Normal file
@ -0,0 +1,24 @@
|
||||
public class A110x_ex {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user