2016-04-29 11:07:02 -07:00
|
|
|
/*
|
|
|
|
|
* Author: Abhishek Malik <abhishek.malik@intel.com>
|
|
|
|
|
* Copyright (c) 2016 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.
|
2016-04-29 11:07:02 -07:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2016-04-29 11:07:02 -07:00
|
|
|
*/
|
|
|
|
|
import upm_max5487.MAX5487;
|
|
|
|
|
|
2018-02-27 12:12:09 -08:00
|
|
|
public class MAX5487_Example {
|
2016-04-29 11:07:02 -07:00
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
try {
|
|
|
|
|
System.loadLibrary("javaupm_max5487");
|
|
|
|
|
System.loadLibrary("mraajava");
|
|
|
|
|
} catch (UnsatisfiedLinkError e) {
|
|
|
|
|
System.err.println(
|
|
|
|
|
"Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
|
|
|
|
|
e);
|
|
|
|
|
System.exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
//! [Interesting]
|
|
|
|
|
MAX5487 sensor = new MAX5487(7);
|
|
|
|
|
|
|
|
|
|
// Power LED UP
|
|
|
|
|
for(int i=0; i<255; i++){
|
|
|
|
|
sensor.setWiperA((short)i);
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(5);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
2017-03-20 14:26:50 -07:00
|
|
|
System.out.println("The following Exception occurred: "+e.getMessage());
|
2016-04-29 11:07:02 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Power LED DOWN
|
|
|
|
|
for(int i=0; i<255; i++){
|
|
|
|
|
sensor.setWiperA((short)(255 - i));
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(5);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
2017-03-20 14:26:50 -07:00
|
|
|
System.out.println("The following exception occurred: "+e.getMessage());
|
2016-04-29 11:07:02 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println("Exiting...");
|
|
|
|
|
//! [Interesting]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|