diff options
Diffstat (limited to 'peripheral/libupm/examples/java')
99 files changed, 0 insertions, 5452 deletions
diff --git a/peripheral/libupm/examples/java/A110XSample.java b/peripheral/libupm/examples/java/A110XSample.java deleted file mode 100644 index 18d17bc..0000000 --- a/peripheral/libupm/examples/java/A110XSample.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class A110XSample { - - public static void main(String[] args) throws InterruptedException { - //! [Interesting] - // Instantiate an A110X sensor on digital pin D2 - upm_a110x.A110X hall = new upm_a110x.A110X(2); - - // check every second for the presence of a magnetic field (south polarity) - while(true){ - if(hall.magnetDetected()) - System.out.println("Magnet (south polarity) detected."); - else - System.out.println("No magnet detected."); - - Thread.sleep(1000); - } - //! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/A110X_intrSample.java b/peripheral/libupm/examples/java/A110X_intrSample.java deleted file mode 100644 index 53d23a5..0000000 --- a/peripheral/libupm/examples/java/A110X_intrSample.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class A110X_intrSample { - - public static int counter=0; - - public static void main(String[] args) throws InterruptedException { - //! [Interesting] - // Instantiate an A110X sensor on digital pin D2 - upm_a110x.A110X hall = new upm_a110x.A110X(2); - - // This example uses a user-supplied interrupt handler to count - // pulses that occur when a magnetic field of the correct polarity - // is detected. This could be used to measure the rotations per - // minute (RPM) of a rotor for example. - - A110XISR callback = new A110XISR(); - hall.installISR(callback); - - while(true){ - System.out.println("Counter: " + counter); - Thread.sleep(1000); - } - //! [Interesting] - } -} - -class A110XISR implements Runnable { - public A110XISR(){ - super(); - } - public void run(){ - A110X_intrSample.counter++; - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/ADC121C021Sample.java b/peripheral/libupm/examples/java/ADC121C021Sample.java deleted file mode 100644 index 5e34cd4..0000000 --- a/peripheral/libupm/examples/java/ADC121C021Sample.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class ADC121C021Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate an ADC121C021 on I2C bus 0 - upm_adc121c021.ADC121C021 adc = new upm_adc121c021.ADC121C021(0); - - // An analog sensor, such as a Grove light sensor, - // must be attached to the adc· - // Prints the value and corresponding voltage every 50 milliseconds - while (true) { - int val = adc.value(); - - System.out.println("ADC value: " + val + "Volts = " + adc.valueToVolts(val)); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Ad8232Example.java b/peripheral/libupm/examples/java/Ad8232Example.java deleted file mode 100644 index 3b6102b..0000000 --- a/peripheral/libupm/examples/java/Ad8232Example.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -* Author: Abhishek Malik <abhishek.malik@intel.com> -* Copyright (c) 2016 Intel Corporation. -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -import upm_ad8232.AD8232; - -public class Ad8232Example { - - static { - try { - System.loadLibrary("javaupm_ad8232"); - 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] - // Instantiate a Ad8232 sensor on digital pins 10 (LO+), 11 (LO-) - // and an analog pin, 0 (OUTPUT) - AD8232 ad8232 = new AD8232(10, 11, 0); - while(true){ - // Output the raw numbers from the ADC, for plotting elsewhere. - // A return of 0 indicates a Lead Off (LO) condition. - // In theory, this data could be fed to software like Processing - // (https://www.processing.org/) to plot the data just like an - // EKG you would see in a hospital. - System.out.println(ad8232.value()); - try { - Thread.sleep(1); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - System.out.println("The following error has occured: "+e.getMessage()); - } - } - } - -} diff --git a/peripheral/libupm/examples/java/Adxl345Sample.java b/peripheral/libupm/examples/java/Adxl345Sample.java deleted file mode 100644 index 028f658..0000000 --- a/peripheral/libupm/examples/java/Adxl345Sample.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class Adxl345Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - short[] val; - float[] accel; - - // Note: Sensor only works at 3.3V on the Intel Edison with Arduino - // breakout - upm_adxl345.Adxl345 sensor = new upm_adxl345.Adxl345(0); - - while (true) { - sensor.update(); - val = sensor.getRawValues(); - accel = sensor.getAcceleration(); - - System.out.println("Current scale: " + sensor.getScale()); - System.out.println("Raw Values: X: " + val[0] + " Y: " + val[1] + " Z: " + val[2]); - System.out.println("Acceleration: X: " + accel[0] + "g Y: " + accel[1] + "g Z: " - + accel[2] + "g"); - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Apds9002.java b/peripheral/libupm/examples/java/Apds9002.java deleted file mode 100644 index 4bb5de8..0000000 --- a/peripheral/libupm/examples/java/Apds9002.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_apds9002.APDS9002; - -public class Apds9002 { - - public static void main(String[] args) { - // TODO Auto-generated method stub - //! [Interesting] - // Instantiate the APDS9002 (Grove luminance sensor) on the Analog pin A0 - APDS9002 lum = new APDS9002(0); - - while(true){ - System.out.println("The Luminance value is : "+lum.value()); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - System.out.println("The following exception occured: "+e.getMessage()); - } - } - //! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/BISS0001Sample.java b/peripheral/libupm/examples/java/BISS0001Sample.java deleted file mode 100644 index eaacacf..0000000 --- a/peripheral/libupm/examples/java/BISS0001Sample.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class BISS0001Sample{ - - public static void main(String[] args) throws InterruptedException { -//! [Interesting] - // Instantiate a Grove Motion sensor on GPIO pin D7 - upm_biss0001.BISS0001 motion = new upm_biss0001.BISS0001(7); - - while (true) { - boolean value = motion.value(); - - if(value) - System.out.println("Detecting moving object"); - else - System.out.println("No moving objects detected"); - - Thread.sleep(1000); - } -//! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/BMPX8XSample.java b/peripheral/libupm/examples/java/BMPX8XSample.java deleted file mode 100644 index c803121..0000000 --- a/peripheral/libupm/examples/java/BMPX8XSample.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class BMPX8XSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a BMPX8X sensor on I2C - upm_bmpx8x.BMPX8X sensor = new upm_bmpx8x.BMPX8X(0); - - // Print the pressure, altitude, sea level, and - // temperature values every second - while (true) { - System.out.println("Pressure: " + sensor.getPressure()); - System.out.println("Altitude: " + sensor.getAltitude()); - System.out.println("Sealevel pressure: " - + sensor.getSealevelPressure()); - System.out.println("Temperature: " + sensor.getTemperature()); - System.out.println(); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/BuzzerSample.java b/peripheral/libupm/examples/java/BuzzerSample.java deleted file mode 100644 index e94be7f..0000000 --- a/peripheral/libupm/examples/java/BuzzerSample.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class BuzzerSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - int chord[] = { - upm_buzzer.javaupm_buzzer.DO, - upm_buzzer.javaupm_buzzer.RE, - upm_buzzer.javaupm_buzzer.MI, - upm_buzzer.javaupm_buzzer.FA, - upm_buzzer.javaupm_buzzer.SOL, - upm_buzzer.javaupm_buzzer.LA, - upm_buzzer.javaupm_buzzer.SI}; - - // Instantiate a buzzer on digital pin D5 - upm_buzzer.Buzzer sound = new upm_buzzer.Buzzer(5); - - // print sensor name - System.out.println(sound.name()); - - for (int i = 0; i < chord.length; i++) { - // play each note for one second - int note = sound.playSound(chord[i], 1000000); - System.out.println(note); - - Thread.sleep(100); - } - // ! [Interesting] - sound.stopSound(); - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Buzzer_soundSample.java b/peripheral/libupm/examples/java/Buzzer_soundSample.java deleted file mode 100644 index 576d888..0000000 --- a/peripheral/libupm/examples/java/Buzzer_soundSample.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class Buzzer_soundSample { - - public static void main(String[] args) throws InterruptedException { - //! [Interesting] - int chord[] = { - upm_buzzer.javaupm_buzzer.DO, - upm_buzzer.javaupm_buzzer.RE, - upm_buzzer.javaupm_buzzer.MI, - upm_buzzer.javaupm_buzzer.FA, - upm_buzzer.javaupm_buzzer.SOL, - upm_buzzer.javaupm_buzzer.LA, - upm_buzzer.javaupm_buzzer.SI - }; - - // Instantiate a buzzer on digital pin D5 - upm_buzzer.Buzzer sound = new upm_buzzer.Buzzer(5); - - // print sensor name - System.out.println(sound.name()); - - for (int i = 0; i < chord.length; i++) { - // play each note for one second - int note = sound.playSound( chord[i], 1000000); - System.out.println(note); - - Thread.sleep(100); - } - //! [Interesting] - sound.stopSound(); - } - - -} diff --git a/peripheral/libupm/examples/java/CJQ4435Sample.java b/peripheral/libupm/examples/java/CJQ4435Sample.java deleted file mode 100644 index 333c20e..0000000 --- a/peripheral/libupm/examples/java/CJQ4435Sample.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class CJQ4435Sample { - - public static void main(String[] args) throws InterruptedException { - // Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3 - upm_cjq4435.CJQ4435 mosfet = new upm_cjq4435.CJQ4435(3); - - mosfet.setPeriodMS(10); - mosfet.enable(true); - - while (true) { - // start with a duty cycle of 0.0 (off) and increment to 1.0 (on) - for (float i = 0; i <= 1; i += 0.1) { - mosfet.setDutyCycle(i); - Thread.sleep(100); - } - Thread.sleep(1000); - - // Now take it back down - // start with a duty cycle of 1.0 (on) and decrement to 0.0 (off) - for (float i = 1; i >= 0; i -= 0.1) { - mosfet.setDutyCycle(i); - Thread.sleep(100); - } - Thread.sleep(1000); - } - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/CMakeLists.txt b/peripheral/libupm/examples/java/CMakeLists.txt deleted file mode 100644 index 95d187a..0000000 --- a/peripheral/libupm/examples/java/CMakeLists.txt +++ /dev/null @@ -1,116 +0,0 @@ -find_package(Java REQUIRED) -include(UseJava) - -macro(add_example example_name jar_name) - set(example_src "${example_name}.java") - set(example_jar "${CMAKE_CURRENT_BINARY_DIR}/../../src/${jar_name}/upm_${jar_name}.jar") - - add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar}) -endmacro() - -macro(add_example_with_path example_name jar_path) - set(example_src "${example_name}.java") - set(example_jar "${CMAKE_CURRENT_BINARY_DIR}/../../src/${jar_path}") - - add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar}) -endmacro() - -add_example(A110X_intrSample a110x) -add_example(A110XSample a110x) -add_example(ADC121C021Sample adc121c021) -add_example(Adxl345Sample adxl345) -add_example(Apds9002 apds9002) -add_example(BISS0001Sample biss0001) -add_example(BMPX8XSample bmpx8x) -add_example(BuzzerSample buzzer) -add_example(Buzzer_soundSample buzzer) -add_example(CJQ4435Sample cjq4435) -add_example(DS1307Sample ds1307) -add_example(ENC03RSample enc03r) -add_example(ES08ASample servo) -add_example(GroveButtonSample grove) -add_example(GroveButton_intrSample grove) -add_example(GroveCollision grovecollision) -add_example(GroveEHRSample groveehr) -add_example(GroveEmg groveemg) -add_example(GroveGsr grovegsr) -add_example(GroveLed_multiSample grove) -add_example(GroveLEDSample grove) -add_example(GroveLightSample grove) -add_example(GroveLineFinderSample grovelinefinder) -add_example(GroveMDSample grovemd) -add_example(GroveMoistureSample grovemoisture) -add_example(GroveMQ3 gas) -add_example(GroveMQ9 gas) -add_example(GroveO2Example groveo2) -add_example(GroveQTouch at42qt1070) -add_example(GroveRelaySample grove) -add_example(GroveRotarySample grove) -add_example(GROVESCAMSample grovescam) -add_example(GroveSlideSample grove) -add_example(GroveSpeakerSample grovespeaker) -add_example(GroveTempSample grove) -add_example(GroveVDivSample grovevdiv) -add_example(GroveWaterSample grovewater) -add_example(GroveWFSSample grovewfs) -add_example(GUVAS12DSample guvas12d) -add_example(H3LIS331DLSample h3lis331dl) -add_example(HCSR04Sample hcsr04) -add_example(HM11Sample hm11) -add_example(Hmc5883lSample hmc5883l) -add_example(HMTRPSample hmtrp) -add_example(HP20xExample hp20x) -add_example(HTU21DSample htu21d) -add_example(Itg3200Sample itg3200) -add_example(Joystick12Sample joystick12) -add_example(LDT0028Sample ldt0028) -add_example(LoLSample lol) -add_example(LSM303Sample lsm303) -add_example(M24LR64ESample m24lr64e) -add_example(MAX44000Sample max44000) -add_example(MHZ16Sample mhz16) -add_example(MicrophoneSample mic) -add_example(MMA7455Sample mma7455) -add_example(MMA7660Sample mma7660) -add_example(MPL3115A2Sample mpl3115a2) -add_example(MPR121Sample mpr121) -add_example(MPU9150Sample mpu9150) -add_example(MQ2Sample gas) -add_example(MQ303ASample mq303a) -add_example(MQ5Sample gas) -add_example(GroveLEDBar my9221) -add_example(NRF24L01_receiverSample nrf24l01) -add_example(NRF24L01_transmitterSample nrf24l01) -add_example(NUNCHUCKSample nunchuck) -add_example(OTP538USample otp538u) -add_example(PPD42NSSample ppd42ns) -add_example(PulsensorSample pulsensor) -add_example(RFR359FSample rfr359f) -add_example(RotaryEncoderSample rotaryencoder) -add_example(RPR220_intrSample rpr220) -add_example(RPR220Sample rpr220) -add_example(ST7735Sample st7735) -add_example(StepMotorSample stepmotor) -add_example(TM1637Sample tm1637) -add_example(TP401Sample gas) -add_example(TSL2561Sample tsl2561) -add_example(TTP223Sample ttp223) -add_example(Ublox6Sample ublox6) -add_example(ULN200XASample uln200xa) -add_example(WaterLevelSensor waterlevel) -add_example(WT5001Sample wt5001) -add_example(YG1006Sample yg1006) -add_example(ZFM20Sample zfm20) -add_example(Ad8232Example ad8232) -add_example(Gp2y0aExample gp2y0a) -add_example(Th02Example th02) -add_example(FlexSensorExample flex) - - -add_example_with_path(Jhd1313m1_lcdSample lcd/upm_i2clcd.jar) -add_example_with_path(Jhd1313m1Sample lcd/upm_i2clcd.jar) -add_example_with_path(Lcm1602_i2cSample lcd/upm_i2clcd.jar) -add_example_with_path(Lcm1602_parallelSample lcd/upm_i2clcd.jar) -add_example_with_path(SSD1308_oledSample lcd/upm_i2clcd.jar) -add_example_with_path(SSD1327_oledSample lcd/upm_i2clcd.jar) - diff --git a/peripheral/libupm/examples/java/DS1307Sample.java b/peripheral/libupm/examples/java/DS1307Sample.java deleted file mode 100644 index 89ae5dc..0000000 --- a/peripheral/libupm/examples/java/DS1307Sample.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class DS1307Sample { - - static private void printTime(upm_ds1307.DS1307 rtc) { - System.out.print("The time is: " + rtc.getMonth() + "/" + rtc.getDayOfMonth() + "/" - + rtc.getYear() + " " + rtc.getHours() + ":" + rtc.getMinutes() + ":" - + rtc.getSeconds()); - - if (rtc.getAmPmMode()) { - if (rtc.getAmPmMode()) - System.out.print(" PM"); - else - System.out.print(" AM"); - } - - System.out.println(); - - if (rtc.getAmPmMode()) - System.out.println("Clock is in AM/PM mode"); - else - System.out.println("Clock is in 24h mode"); - - } - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a DS1037 on I2C bus 0 - upm_ds1307.DS1307 rtc = new upm_ds1307.DS1307(0); - - // always do this first - System.out.println("Loading the current time..."); - if (!rtc.loadTime()) { - System.err.println("rtc->loadTime() failed."); - System.exit(-1); - } - - printTime(rtc); - - // set the year as an example - System.out.println("setting the year to 50"); - rtc.setYear(50); - rtc.setTime(); - - // reload the time and print it - rtc.loadTime(); - printTime(rtc); - - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/ENC03RSample.java b/peripheral/libupm/examples/java/ENC03RSample.java deleted file mode 100644 index c2aa0bd..0000000 --- a/peripheral/libupm/examples/java/ENC03RSample.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class ENC03RSample { - private static final long CALIBRATION_SAMPLES = 1000; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - - // Instantiate a ENC03R on analog pin A0 - upm_enc03r.ENC03R gyro = new upm_enc03r.ENC03R(0); - - System.out.println("Please place the sensor in a stable location, and do not"); - System.out.println("move it while calibration takes place"); - System.out.println("This may take a couple of minutes."); - - gyro.calibrate(CALIBRATION_SAMPLES); - System.out.println("Calibration complete. Reference value: " + gyro.calibrationValue()); - - // Read the input and print both the raw value and the angular velocity, - // waiting 1 second between readings - while (true) { - long val = gyro.value(); - double av = gyro.angularVelocity(val); - - System.out.println("Raw value: " + val + ", angular velocity: " + av + " deg/s"); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/ES08ASample.java b/peripheral/libupm/examples/java/ES08ASample.java deleted file mode 100644 index 0285204..0000000 --- a/peripheral/libupm/examples/java/ES08ASample.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class ES08ASample { - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_servo.ES08A servo = new upm_servo.ES08A(6); - - // Sets the shaft to 180, then to 90, then to 0, - // then back to 90, and finally back to 180, - // pausing for a second in between each angle - servo.setAngle(180); - System.out.println("Set angle to 180"); - Thread.sleep(1000); - - servo.setAngle(90); - System.out.println("Set angle to 90"); - Thread.sleep(1000); - - servo.setAngle(0); - System.out.println("Set angle to 0"); - Thread.sleep(1000); - - servo.setAngle(90); - System.out.println("Set angle to 90"); - Thread.sleep(1000); - - servo.setAngle(180); - System.out.println("Set angle to 180"); - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/FlexSensorExample.java b/peripheral/libupm/examples/java/FlexSensorExample.java deleted file mode 100644 index ce4e697..0000000 --- a/peripheral/libupm/examples/java/FlexSensorExample.java +++ /dev/null @@ -1,41 +0,0 @@ -import upm_flex.Flex; - -public class FlexSensorExample { - - static { - try { - System.loadLibrary("javaupm_flex"); - 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] - // The was tested with a Spectra Symbol flex sensor. - // We attached a 22K resistor to a breadboard, - // with 1 end attached to GND and the other connected to - // both the flex sensor and A0. - // The flex sensor was connected on 1 pin to the 22K resistor and A0 - // and on the other pin to 5V. - - // Instantiate a Flex sensor on analog pin A0 - Flex flex = new Flex(0); - while(true){ - System.out.println("Flex Sensor value is: "+flex.value()); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - //! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GROVESCAMSample.java b/peripheral/libupm/examples/java/GROVESCAMSample.java deleted file mode 100644 index 1e4a374..0000000 --- a/peripheral/libupm/examples/java/GROVESCAMSample.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class GROVESCAMSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Grove Serial Camera on UART 0 - upm_grovescam.GROVESCAM camera = new upm_grovescam.GROVESCAM(0); - - // make sure port is initialized properly. 115200 baud is the default. - if (!camera.setupTty()) { - System.err.println("Failed to setup tty port parameters"); - System.exit(-1); - } - - if (camera.init()) - System.out.println("Initialized..."); - else - System.out.println("Initialization failed"); - - if (camera.preCapture()) - System.out.println("preCapture succeeded..."); - else - System.out.println("preCapture failed."); - - if (camera.doCapture()) - System.out.println("doCapture succeeded..."); - else - System.out.println("doCapture failed."); - - if (camera.getImageSize() > 0) { - System.out.println("Storing image.jpg..."); - - if (camera.storeImage("image.jpg")) - System.out.println("storeImage succeeded..."); - else - System.out.println("storeImage failed."); - - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GUVAS12DSample.java b/peripheral/libupm/examples/java/GUVAS12DSample.java deleted file mode 100644 index 0cd4115..0000000 --- a/peripheral/libupm/examples/java/GUVAS12DSample.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GUVAS12DSample { - // analog voltage, usually 3.3 or 5.0 - private static final float GUVAS12D_AREF = 5; - private static final int SAMPLES_PER_QUERY = 1024; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a GUVAS12D on analog pin A3 - upm_guvas12d.GUVAS12D volts = new upm_guvas12d.GUVAS12D(3); - - while (true) { - float value = volts.value(GUVAS12D_AREF, SAMPLES_PER_QUERY); - - System.out.println("AREF: " + GUVAS12D_AREF - + ", Voltage value (higher means more UV): " + value); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Gp2y0aExample.java b/peripheral/libupm/examples/java/Gp2y0aExample.java deleted file mode 100644 index 0837f55..0000000 --- a/peripheral/libupm/examples/java/Gp2y0aExample.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2016 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -import upm_gp2y0a.GP2Y0A; - -public class Gp2y0aExample { - - public static final float GP2Y0A_AREF = 5; - public static final short SAMPLES_PER_QUERY = 20; - - static { - try { - System.loadLibrary("javaupm_gp2y0a"); - 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] - // Note, for the Grove 80cm version of this sensor, due to the way - // it is wired, you need to plug this into the A0 port, where it - // will use the available A1 pin for data. - - // Instantiate a GP2Y0A on analog pin A1 - GP2Y0A gp2y0a = new GP2Y0A(1); - - // The higher the voltage (closer to AREF) the closer the object is. NOTE: - // the measured voltage will probably not exceed 3.3 volts. - // Every second, print the averaged voltage value (averaged over 20 samples). - while(true){ - System.out.println("AREF: " + GP2Y0A_AREF + "\t, Voltage Value (Higher means Closer): "+ gp2y0a.value(GP2Y0A_AREF, SAMPLES_PER_QUERY)); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - System.out.println("The following exception occured: "+e.getMessage()); - } - } - //! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveButtonSample.java b/peripheral/libupm/examples/java/GroveButtonSample.java deleted file mode 100644 index 9be6e2f..0000000 --- a/peripheral/libupm/examples/java/GroveButtonSample.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveButtonSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Create the button object using GPIO pin 2 - upm_grove.GroveButton button = new upm_grove.GroveButton(2); - - while (true) { - System.out.println(button.name() + " value is " + button.value()); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveButton_intrSample.java b/peripheral/libupm/examples/java/GroveButton_intrSample.java deleted file mode 100644 index ad0d72e..0000000 --- a/peripheral/libupm/examples/java/GroveButton_intrSample.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveButton_intrSample { - - public static int counter = 0; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_grove.GroveButton b = new upm_grove.GroveButton(2); - - ButtonISR callback = new ButtonISR(); - b.installISR(2, callback); - - while (true) { - System.out.println("Counter: " + counter); - Thread.sleep(1000); - } - // ! [Interesting] - } -} - -class ButtonISR implements Runnable { - public ButtonISR() { - super(); - } - - public void run() { - GroveButton_intrSample.counter++; - System.out.println("Button pressed!"); - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveCollision.java b/peripheral/libupm/examples/java/GroveCollision.java deleted file mode 100644 index e1ace72..0000000 --- a/peripheral/libupm/examples/java/GroveCollision.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_grovecollision.*; - -public class GroveCollision { - - public static void main(String[] args) { - // Initializing the sensor on D2 on the Base Shield - upm_grovecollision.GroveCollision collision = new upm_grovecollision.GroveCollision(2); - boolean collisionState = false; - - // ! [Interesting] - while(true){ - if(collision.isColliding() && !collisionState){ - System.out.println("Collision!!"); - collisionState = true; - } - else if (collisionState){ - System.out.println("No Collision!"); - collisionState = false; - } - } - // ! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/GroveEHRSample.java b/peripheral/libupm/examples/java/GroveEHRSample.java deleted file mode 100644 index ddec36a..0000000 --- a/peripheral/libupm/examples/java/GroveEHRSample.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class GroveEHRSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2 - upm_groveehr.GroveEHR heart = new upm_groveehr.GroveEHR(2); - - // set the beat counter to 0, init the clock and start counting beats - heart.clearBeatCounter(); - heart.initClock(); - heart.startBeatCounter(); - - while (true) { - long millis = heart.getMillis(); - long beats = heart.beatCounter(); - - // heartRate() requires that at least 5 seconds pass before - // returning anything other than 0 - int hr = heart.heartRate(); - - // output milliseconds passed, beat count, and computed heart rate - System.out.println("Millis: " + millis + ", Beats: " + beats + ", Heart rate: " + hr); - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveEmg.java b/peripheral/libupm/examples/java/GroveEmg.java deleted file mode 100644 index eaa8ba0..0000000 --- a/peripheral/libupm/examples/java/GroveEmg.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -import upm_groveemg.GroveEMG; - -public class GroveEmg { - - public static void main(String[] args) { - // TODO Auto-generated method stub - //! [Interesting] - // Instantiating the Grove EMG sensor on Analog pin 0 - GroveEMG emg = new GroveEMG(0); - System.out.println("Calibrating ... "); - emg.calibrate(); - - while(true){ - System.out.println("EMG Val: "+emg.value()); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - System.out.println("The following exception occured: "+e.getMessage()); - } - } - } - //! [Interesting] -} diff --git a/peripheral/libupm/examples/java/GroveGsr.java b/peripheral/libupm/examples/java/GroveGsr.java deleted file mode 100644 index 08a04b9..0000000 --- a/peripheral/libupm/examples/java/GroveGsr.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_grovegsr.GroveGSR; - -public class GroveGsr { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - //! [Interesting] - // Instantiate a Grove GSR sensor on analog pin A0 - GroveGSR gsr = new GroveGSR(0); - System.out.println("Calibrating..."); - gsr.calibrate(); - - while(true){ - System.out.println("Value: "+gsr.value()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - System.out.println("The following exception occured: "+e.getMessage()); - } - } - //! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/GroveLEDBar.java b/peripheral/libupm/examples/java/GroveLEDBar.java deleted file mode 100644 index 51d2f71..0000000 --- a/peripheral/libupm/examples/java/GroveLEDBar.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveLEDBar { - - public static void main(String[] args) throws InterruptedException { - //! [Interesting] - // Instantiate a Grove LED Bar, with Data pin D8 and Clock pin D9 - upm_my9221.GroveLEDBar bar = new upm_my9221.GroveLEDBar((short) 8, (short) 9); - - while (true) { - for (short idx = 1; idx < 11; idx++) { - bar.setBarLevel(idx); - Thread.sleep(100); - } - } - //! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/GroveLEDSample.java b/peripheral/libupm/examples/java/GroveLEDSample.java deleted file mode 100644 index b996449..0000000 --- a/peripheral/libupm/examples/java/GroveLEDSample.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Author: Andrei Vasiliu <andrei.vasiliu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveLEDSample { - public static void main (String args[]) throws InterruptedException { - //! [Interesting] - upm_grove.GroveLed led = new upm_grove.GroveLed(2); - - for (int i = 0; i < 10; ++i) { - led.on(); - Thread.sleep(1000); - led.off(); - Thread.sleep(1000); - } - led.delete(); - //! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/GroveLed_multiSample.java b/peripheral/libupm/examples/java/GroveLed_multiSample.java deleted file mode 100644 index 98d792c..0000000 --- a/peripheral/libupm/examples/java/GroveLed_multiSample.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class GroveLed_multiSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a grove LED on D2. Here we are controlling a Grove - // Multi-color flash LED. We just just need to turn it on - it will - // then cycle through various colors (red, green, blue, purple) on it's - // own until turned off. - upm_grove.GroveLed led = new upm_grove.GroveLed(2); - - // start the light show - led.on(); - - // just sleep until interrupted - while (true) { - Thread.sleep(1); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveLightSample.java b/peripheral/libupm/examples/java/GroveLightSample.java deleted file mode 100644 index 611b744..0000000 --- a/peripheral/libupm/examples/java/GroveLightSample.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveLightSample { - public static void main(String args[]) throws InterruptedException { - // ! [Interesting] - upm_grove.GroveLight gl = new upm_grove.GroveLight(2); - - while (true) { - float raw_value = gl.raw_value(); - float value = gl.value(); - - System.out.println("raw value: " + raw_value); - System.out.println("value: " + value); - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveLineFinderSample.java b/peripheral/libupm/examples/java/GroveLineFinderSample.java deleted file mode 100644 index 2baa418..0000000 --- a/peripheral/libupm/examples/java/GroveLineFinderSample.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveLineFinderSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Grove Line Finder sensor on digital pin D2 - upm_grovelinefinder.GroveLineFinder finder = new upm_grovelinefinder.GroveLineFinder(2); - // check every second for the presence of white detection - while (true) { - boolean val = finder.whiteDetected(); - if (val) { - System.out.println("White detected"); - } else { - System.out.println("Black detected"); - } - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveMDSample.java b/peripheral/libupm/examples/java/GroveMDSample.java deleted file mode 100644 index 9bb4bb7..0000000 --- a/peripheral/libupm/examples/java/GroveMDSample.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveMDSample { - private static final short speed50 = 127; - private static final short speed0 = 0; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate an I2C Grove Motor Driver on I2C bus 0 - upm_grovemd.GroveMD motors = new upm_grovemd.GroveMD(); - - // set direction to clockwise (CW) and set speed to 50% - System.out.println("Spin M1 and M2 at half speed for 3 seconds"); - motors.setMotorDirections(upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CW, - upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CW); - motors.setMotorSpeeds(speed50, speed50); - Thread.sleep(3000); - - // counter clockwise (CCW) - System.out.println("Reversing M1 and M2 for 3 seconds"); - motors.setMotorDirections(upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CCW, - upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CCW); - Thread.sleep(3000); - - // stop motors - System.out.println("Stopping motors"); - motors.setMotorSpeeds(speed0, speed0); - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveMQ3.java b/peripheral/libupm/examples/java/GroveMQ3.java deleted file mode 100644 index c101189..0000000 --- a/peripheral/libupm/examples/java/GroveMQ3.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_gas.Gas; -import upm_gas.MQ2; -import upm_gas.MQ3; -import upm_gas.MQ4; -import upm_gas.MQ5; -import upm_gas.MQ6; -import upm_gas.MQ7; -import upm_gas.MQ8; -import upm_gas.MQ9; -import upm_gas.TP401; -import upm_gas.thresholdContext; - -public class GroveMQ3 { - - public static void main(String[] args) { - // TODO Auto-generated method stub - //! [Interesting] - // initialize the sensor on A0 - MQ3 mq3 = new MQ3(0); - - short[] buffer = new short[128]; - - thresholdContext context = new thresholdContext(); - - context.setAverageReading(0); - context.setRunningAverage(0); - context.setAveragedOver(2); - - int len; - int thres; - while(true){ - len = mq3.getSampledWindow((long)2, buffer); - - if(len != 0){ - thres = mq3.findThreshold(context, 30, buffer); - mq3.printGraph(context, (short)5); - if(thres != 0){ - // do something - System.out.println("threshold is crossed"); - } - } - } - //! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/GroveMQ9.java b/peripheral/libupm/examples/java/GroveMQ9.java deleted file mode 100644 index 24b916d..0000000 --- a/peripheral/libupm/examples/java/GroveMQ9.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_gas.Gas; -import upm_gas.MQ2; -import upm_gas.MQ3; -import upm_gas.MQ4; -import upm_gas.MQ5; -import upm_gas.MQ6; -import upm_gas.MQ7; -import upm_gas.MQ8; -import upm_gas.MQ9; -import upm_gas.TP401; -import upm_gas.thresholdContext; - -public class GroveMQ9 { - - public static void main(String[] args) { - // TODO Auto-generated method stub - //! [Interesting] - // initialize the sensor on A0 - MQ9 mq9 = new MQ9(0); - - short[] buffer = new short[128]; - - thresholdContext context = new thresholdContext(); - - context.setAverageReading(0); - context.setRunningAverage(0); - context.setAveragedOver(2); - - int len; - int thres; - while(true){ - len = mq9.getSampledWindow((long)2, buffer); - - if(len != 0){ - thres = mq9.findThreshold(context, 30, buffer); - mq9.printGraph(context, (short)5); - if(thres != 0){ - // do something - System.out.println("threshold is crossed"); - } - } - } - //! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/GroveMoistureSample.java b/peripheral/libupm/examples/java/GroveMoistureSample.java deleted file mode 100644 index 8fb32d6..0000000 --- a/peripheral/libupm/examples/java/GroveMoistureSample.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveMoistureSample { - public static void main(String args[]) throws InterruptedException { - // ! [Interesting] - upm_grovemoisture.GroveMoisture gm = new upm_grovemoisture.GroveMoisture(1); - - while (true) { - int moisture_val = gm.value(); - String result; - - if (moisture_val >= 0 && moisture_val < 300) - result = "Dry"; - else if ((moisture_val >= 0 && moisture_val < 300)) - result = "Moist"; - else - result = "Wet"; - - System.out.println("Moisture Value: " + moisture_val + ", " + result); - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveO2Example.java b/peripheral/libupm/examples/java/GroveO2Example.java deleted file mode 100644 index fe22b80..0000000 --- a/peripheral/libupm/examples/java/GroveO2Example.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_groveo2.GroveO2; - -public class GroveO2Example { - - public static void main(String[] args) { - // TODO Auto-generated method stub - //! [Interesting] - // Initializing the Grove O2 sensor on the A) analog pin - GroveO2 o2 = new GroveO2(0); - - while(true){ - System.out.println("The output voltage is: "+o2.voltageValue()); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - System.out.println("The following exception has occured: "+e.getMessage()); - } - } - //! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/GroveQTouch.java b/peripheral/libupm/examples/java/GroveQTouch.java deleted file mode 100644 index 795e4ac..0000000 --- a/peripheral/libupm/examples/java/GroveQTouch.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_at42qt1070.AT42QT1070; - -public class GroveQTouch { - - public static void main(String[] args) { - // TODO Auto-generated method stub - // Instantiating the Q Touch sensor on the I2C bus 0 - AT42QT1070 touch = new AT42QT1070(0, (short) 0x1b); - short pressedButtons; - - // ! [Interesting] - while(true){ - touch.updateState(); - printButtons(touch.getButtons()); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - // ! [Interesting] - } - - /** - * This function prints out the button numbers from 0 through 6 - * @param buttonNumber - */ - public static void printButtons(int buttonNumber){ - boolean buttonPressed = false; - System.out.print("Button Pressed: "); - for(int i=0;i<7;i++){ - if((buttonNumber & (1<<i)) != 0){ - System.out.println(i+" "); - buttonPressed = true; - } - } - - - - if(!buttonPressed){ - System.out.println("None "); - } - } -} diff --git a/peripheral/libupm/examples/java/GroveRelaySample.java b/peripheral/libupm/examples/java/GroveRelaySample.java deleted file mode 100644 index 56a044b..0000000 --- a/peripheral/libupm/examples/java/GroveRelaySample.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveRelaySample { - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Create the button object using UART - upm_grove.GroveRelay relay = new upm_grove.GroveRelay(5); - - for (int i = 0; i < 3; i++) { - relay.on(); - if (relay.isOn()) - System.out.println("Relay is on"); - Thread.sleep(1000); - - relay.off(); - if (relay.isOff()) - System.out.println("Relay is off"); - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveRotarySample.java b/peripheral/libupm/examples/java/GroveRotarySample.java deleted file mode 100644 index f1b98c7..0000000 --- a/peripheral/libupm/examples/java/GroveRotarySample.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveRotarySample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_grove.GroveRotary knob = new upm_grove.GroveRotary(0); - - while (true) { - float abs_value = knob.abs_value(); // Absolute raw value - float abs_deg = knob.abs_deg(); // Absolute degrees - float abs_rad = knob.abs_rad(); // Absolute radians - float rel_value = knob.rel_value(); // Relative raw value - float rel_deg = knob.rel_deg(); // Relative degrees - float rel_rad = knob.rel_rad(); // Relative radians - - System.out.println("Absolute: " + abs_value + " raw, " + abs_deg + " deg, " + abs_rad - + " rad"); - System.out.println("Relative: " + rel_value + " raw, " + rel_deg + " deg, " + rel_rad - + " rad"); - - Thread.sleep(3000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveSlideSample.java b/peripheral/libupm/examples/java/GroveSlideSample.java deleted file mode 100644 index b159713..0000000 --- a/peripheral/libupm/examples/java/GroveSlideSample.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Author: Andrei Vasiliu <andrei.vasiliu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveSlideSample { - public static void main (String args[]) throws InterruptedException { - //! [Interesting] - // Instantiate new grove slide potentiometer on analog pin A0 - upm_grove.GroveSlide slide = new upm_grove.GroveSlide(0); - - while (true) { - float raw_value = slide.raw_value(); - float value = slide.voltage_value(); - - System.out.println("raw value: " + raw_value); - System.out.println("value: " + value); - - Thread.sleep(2500); - } - //! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/GroveSpeakerSample.java b/peripheral/libupm/examples/java/GroveSpeakerSample.java deleted file mode 100644 index 2e96c89..0000000 --- a/peripheral/libupm/examples/java/GroveSpeakerSample.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Author: Andrei Vasiliu <andrei.vasiliu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveSpeakerSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Grove Speaker on digital pin D2 - upm_grovespeaker.GroveSpeaker speaker = new upm_grovespeaker.GroveSpeaker(2); - - // Play all 7 of the lowest notes - speaker.playAll(); - - // Play a medium C-sharp - speaker.playSound('c', true, "med"); - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveTempSample.java b/peripheral/libupm/examples/java/GroveTempSample.java deleted file mode 100644 index 6878827..0000000 --- a/peripheral/libupm/examples/java/GroveTempSample.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: Andrei Vasiliu <andrei.vasiliu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveTempSample { - public static void main (String args[]) throws InterruptedException { - //! [Interesting] - upm_grove.GroveTemp temp = new upm_grove.GroveTemp(3); - - for (int i = 0; i < 10; ++i) { - - int celsius = temp.value(); - int fahrneheit = celsius * 2 + 32; - - System.out.println("Celsius: " + celsius); - System.out.println("Fahrneheit: " + fahrneheit); - - Thread.sleep(1000); - } - temp.delete(); - //! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/GroveVDivSample.java b/peripheral/libupm/examples/java/GroveVDivSample.java deleted file mode 100644 index 579f2c3..0000000 --- a/peripheral/libupm/examples/java/GroveVDivSample.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class GroveVDivSample { - private static final short gain3 = 3; - private static final short gain10 = 10; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Grove Voltage Divider sensor on analog pin A0 - upm_grovevdiv.GroveVDiv vDiv = new upm_grovevdiv.GroveVDiv(0); - - // collect data and output measured voltage according to the setting - // of the scaling switch (3 or 10) - while (true) { - long val = vDiv.value(100); - float gain3val = vDiv.computedValue(gain3, val); - float gain10val = vDiv.computedValue(gain10, val); - - System.out.println("ADC value: " + val + ", Gain 3: " + gain3val + "v, Gain 10: " - + gain10val); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveWFSSample.java b/peripheral/libupm/examples/java/GroveWFSSample.java deleted file mode 100644 index 5ab4997..0000000 --- a/peripheral/libupm/examples/java/GroveWFSSample.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class GroveWFSSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Grove Water Flow Sensor on digital pin D2 - upm_grovewfs.GroveWFS flow = new upm_grovewfs.GroveWFS(2); - - flow.clearFlowCounter(); - flow.startFlowCounter(); - - while (true) { - System.out.print("Millis: " + flow.getMillis() + " FlowCount: " + flow.flowCounter()); - System.out.println(" Flow Rate: " + flow.flowRate() + " LPM"); - - Thread.sleep(2000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/GroveWaterSample.java b/peripheral/libupm/examples/java/GroveWaterSample.java deleted file mode 100644 index f275df7..0000000 --- a/peripheral/libupm/examples/java/GroveWaterSample.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class GroveWaterSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Grove Water sensor on digital pin D2 - upm_grovewater.GroveWater water = new upm_grovewater.GroveWater(2); - - while (true) { - boolean val = water.isWet(); - if (val) { - System.out.println("Sensor is wet"); - } else { - System.out.println("Sensor is dry"); - } - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/H3LIS331DLSample.java b/peripheral/libupm/examples/java/H3LIS331DLSample.java deleted file mode 100644 index ee1db39..0000000 --- a/peripheral/libupm/examples/java/H3LIS331DLSample.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class H3LIS331DLSample { - - public static void main(String[] args) throws InterruptedException { - //! [Interesting] - int[] val; - float[] accel; - - // Instantiate an H3LIS331DL on I2C bus 0 - upm_h3lis331dl.H3LIS331DL sensor = new upm_h3lis331dl.H3LIS331DL(0); - - // Initialize the device with default values - sensor.init(); - - while(true){ - sensor.update(); - - val = sensor.getRawXYZ(); - System.out.println( "Raw: X: " + val[0] + " Y: " + val[1] + " Z: " + val[2] ); - - accel = sensor.getAcceleration(); - System.out.println( "Acceleration: X: " + accel[0] + " Y: " + accel[1] + " Z: " + accel[2] ); - - Thread.sleep(1000); - } - //! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/HCSR04Sample.java b/peripheral/libupm/examples/java/HCSR04Sample.java deleted file mode 100644 index ee90773..0000000 --- a/peripheral/libupm/examples/java/HCSR04Sample.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class HCSR04Sample { - - // ! [Interesting] - public static void main(String[] args) throws InterruptedException { - upm_hcsr04.HCSR04 sonar = new upm_hcsr04.HCSR04((short) 5, (short) 6); - - Thread.sleep(1000); - - while (true) { - System.out.println("Get distance"); - double distance = sonar.getDistance(upm_hcsr04.javaupm_hcsr04Constants.CM); - System.out.println("Distance: " + distance); - - Thread.sleep(5000); - } - } -} -// ! [Interesting]
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/HM11Sample.java b/peripheral/libupm/examples/java/HM11Sample.java deleted file mode 100644 index b37ae21..0000000 --- a/peripheral/libupm/examples/java/HM11Sample.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class HM11Sample { - - private static final int BUFSIZ = 1024; - - private static void printUsage() { - System.out.println("Usage: java HM11Sample [AT command]"); - - System.out.println("If an argument is supplied on the command line, that argument is"); - System.out.println("sent to the module and the response is printed out."); - System.out.println("If no argument is used, then the address and PIN of the module"); - System.out.println("are queried and the results printed out."); - - } - - private static void sendCommand(upm_hm11.HM11 ble, byte[] cmd) { - byte[] buffer = new byte[BUFSIZ]; - ble.writeData(cmd); - - // wait up to 1 second - if (ble.dataAvailable(1000)) { - ble.readData(buffer); - } else { - System.err.println("Timed out waiting for response"); - } - - } - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a HM11 BLE Module on UART 0 - upm_hm11.HM11 ble = new upm_hm11.HM11(0); - - // make sure port is initialized properly. 9600 baud is the default. - if (!ble.setupTty()) { - System.err.println("Failed to setup tty port parameters"); - System.exit(-1); - } - - printUsage(); - - if (args.length > 0) { - System.out.println("Sending command line argument (" + args[0] + ")..."); - sendCommand(ble, args[0].getBytes()); - } else { - // query the module address - String addr = "AT+ADDR?"; - System.out.println("Querying module address (" + addr + ")..."); - sendCommand(ble, addr.getBytes()); - - Thread.sleep(1000); - - // query the module address - String pin = "AT+PASS?"; - System.out.println("Querying module pin (" + pin + ")..."); - sendCommand(ble, pin.getBytes()); - - // Other potentially useful commands are: - // - // AT+VERS? - query module version - // AT+ROLE0 - set as slave - // AT+ROLE1 - set as master - // AT+CLEAR - clear all previous settings - // AT+RESET - restart the device - // - // A comprehensive list is available from the datasheet at: - // http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf - - } - // ! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/HMTRPSample.java b/peripheral/libupm/examples/java/HMTRPSample.java deleted file mode 100644 index a3d24bd..0000000 --- a/peripheral/libupm/examples/java/HMTRPSample.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class HMTRPSample { - - static private final int bufferLength = 255; - - private static void printUsage() { - System.out.println("Usage:"); - System.out.println("Pass a commandline argument (any argument) to this program"); - System.out.println("to query the radio configuration and output it. NOTE: the"); - System.out.println("radio must be in CONFIG mode for this to work."); - System.out.println("Running this program without arguments will simply transmit"); - System.out.println("'Hello World!' every second, and output any data received from"); - System.out.println("another radio."); - } - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a HMTRP radio device on uart 0 - upm_hmtrp.HMTRP radio = new upm_hmtrp.HMTRP(0); - - // make sure port is initialized properly. 9600 baud is the default. - if (!radio.setupTty()) { - System.err.println("Failed to setup tty port parameters"); - System.exit(-1); - } - printUsage(); - - // By default, this radio simply transmits data sent via writeData() - // and reads any available data via readData(). - - // It can be placed into a configuration mode by grounding the - // CONFIG pin on the module. When this is done, the various - // configuration query and config methods can be used. In this - // example, by default, we just read any data available fom the - // device, and periodically transmit "Hello World". - - // If any argument was specified on the command line, do a simple - // configuration query and output the results. The radio must be in· - // CONFIG mode for this to work. - - if (args.length > 0) { - // config mode - long[] freq = {0}; - long[] dataRate = {0}; - int[] rxBandwidth = {0}; - short[] modulation = {0}; - short[] txPower = {0}; - long[] uartBaud = {0}; - - if (radio.getConfig(freq, dataRate, rxBandwidth, modulation, txPower, uartBaud)) { - System.out.println("Radio configuration:"); - System.out.println("freq: " + freq[0] + " dataRate: " + dataRate[0] - + " rxBandwidth: " + rxBandwidth[0] + "Khz"); - System.out.println("modulation: " + modulation[0] + "Khz txPower: " + txPower[0] - + " uartBaud: " + uartBaud[0]); - } else { - System.err.println("getConfig() failed. Make sure the radio is in CONFIG mode."); - } - } else { - // normal read/write mode - byte[] radioBuffer = new byte[bufferLength]; - byte[] hello = "Hello World".getBytes(); - int counter = 0; - - System.out.println("Running in normal read/write mode."); - - while (true) { - // we don't want the read to block in this example, so always - // check to see if data is available first. - if (radio.dataAvailable()) { - int rv = radio.readData(radioBuffer); - - if (rv > 0) { - System.out.print("Received: "); - for (int i = 0; i < radioBuffer.length; i++) - System.out.print((char) radioBuffer[i]); - System.out.println(); - } else { - System.err.println("Port read error."); - break; - } - continue; - } - - Thread.sleep(100); - - counter++; - // every second, transmit "Hello World!" - if (counter > 10) { - System.out.println("Transmitting hello world..."); - radio.writeData(hello); - counter = 0; - } - } - } - // ! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/HP20xExample.java b/peripheral/libupm/examples/java/HP20xExample.java deleted file mode 100644 index 8082031..0000000 --- a/peripheral/libupm/examples/java/HP20xExample.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_hp20x.HP20X; - -public class HP20xExample { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - //! [Interesting] - // Instantiate the sensor on the default I2C bus and sensor - HP20X hp20x = new HP20X(); - - // Initializing the sensor with the default values - hp20x.init(); - - while(true){ - System.out.println("Temperature: "+hp20x.getTemperature()+"\tPressure: "+hp20x.getPressure()+"\tAltitude: "+hp20x.getAltitude()); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - System.out.println("The following exception occured: "+e.getMessage()); - } - } - //! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/HTU21DSample.java b/peripheral/libupm/examples/java/HTU21DSample.java deleted file mode 100644 index 33ad1a2..0000000 --- a/peripheral/libupm/examples/java/HTU21DSample.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class HTU21DSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - float humidity = 0; - float temperature = 0; - float compRH = 0; - - upm_htu21d.HTU21D sensor = new upm_htu21d.HTU21D(0); - sensor.testSensor(); - - while (true) { - compRH = sensor.getCompRH(); - humidity = sensor.getHumidity(); - temperature = sensor.getTemperature(); - - System.out.println("Humidity: " + humidity + ", Temperature: " + temperature - + ", compensated RH: " + compRH); - - Thread.sleep(5000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Hmc5883lSample.java b/peripheral/libupm/examples/java/Hmc5883lSample.java deleted file mode 100644 index c16439c..0000000 --- a/peripheral/libupm/examples/java/Hmc5883lSample.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class Hmc5883lSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate on I2C - upm_hmc5883l.Hmc5883l compas = new upm_hmc5883l.Hmc5883l(0); - - short[] pos; - - // Set your declination from true north in radians - compas.set_declination(0.2749f); - - while (true) { - // Update the coordinates - compas.update(); - - pos = compas.coordinates(); - System.out.println("Coor: " + pos[0] + " " + pos[1] + " " + pos[2]); - System.out.println("Heading: " + compas.heading() + " Direction:" + compas.direction()); - - Thread.sleep(2000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Itg3200Sample.java b/peripheral/libupm/examples/java/Itg3200Sample.java deleted file mode 100644 index 9edaa92..0000000 --- a/peripheral/libupm/examples/java/Itg3200Sample.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class Itg3200Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - short[] rot; - float[] ang; - - // Note: Sensor not supported on Intel Edison with Arduino breakout - upm_itg3200.Itg3200 gyro = new upm_itg3200.Itg3200(0); - - while (true) { - gyro.update(); - rot = gyro.getRawValues(); - ang = gyro.getRotation(); - - System.out.println("Raw Values: X: " + rot[0] + " Y: " + rot[1] + " Z: " + rot[2]); - System.out.println("Angular Velocities: X: " + ang[0] + " Y: " + ang[1] + " Z: " - + ang[2]); - - System.out.println("Temp: " + gyro.getTemperature() + ", Raw: " + gyro.getRawTemp()); - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Jhd1313m1Sample.java b/peripheral/libupm/examples/java/Jhd1313m1Sample.java deleted file mode 100644 index db84426..0000000 --- a/peripheral/libupm/examples/java/Jhd1313m1Sample.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class Jhd1313m1Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_i2clcd.Jhd1313m1 lcd = new upm_i2clcd.Jhd1313m1(0); - - lcd.setCursor(0, 0); - lcd.write("Hello World"); - lcd.setCursor(1, 2); - lcd.write("Hello World"); - - System.out.println("Sleeping for 5 seconds"); - Thread.sleep(5000); - lcd.clear(); - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java b/peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java deleted file mode 100644 index bda1994..0000000 --- a/peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class Jhd1313m1_lcdSample{ - - public static void main(String[] args) throws InterruptedException { - //! [Interesting] - upm_i2clcd.Jhd1313m1 lcd = new upm_i2clcd.Jhd1313m1(1, 0x3E, 0x62); - - lcd.setCursor(0,0); - lcd.write("Hello World"); - lcd.setCursor(1,2); - lcd.write("Hello World"); - - System.out.println("Sleeping for 5 seconds"); - Thread.sleep(5000); - lcd.clear(); - //! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/Joystick12Sample.java b/peripheral/libupm/examples/java/Joystick12Sample.java deleted file mode 100644 index 31660bc..0000000 --- a/peripheral/libupm/examples/java/Joystick12Sample.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class Joystick12Sample { - - public static void main(String[] args) throws InterruptedException { - //! [Interesting] - // Instantiate a joystick on analog pins A0 and A1 - upm_joystick12.Joystick12 joystick = new upm_joystick12.Joystick12(0,1); - - // Print the X and Y input values every second - while(true){ - float x = joystick.getXInput(); - float y = joystick.getYInput(); - - System.out.println("Driving X: " + x + " , and Y: " + y ); - - Thread.sleep(1000); - } - //! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/Joystick12_exampleSample.java b/peripheral/libupm/examples/java/Joystick12_exampleSample.java deleted file mode 100644 index 442d59c..0000000 --- a/peripheral/libupm/examples/java/Joystick12_exampleSample.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class Joystick12_exampleSample { - - public static void main(String[] args) throws InterruptedException { - //! [Interesting] - // Instantiate a joystick on analog pins A0 and A1 - upm_joystick12.Joystick12 joystick = new upm_joystick12.Joystick12(0,1); - - // Print the X and Y input values every second - while(true){ - float x = joystick.getXInput(); - float y = joystick.getYInput(); - - System.out.println("Driving X: " + x + " , and Y: " + y ); - - Thread.sleep(1000); - } - //! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/LDT0028Sample.java b/peripheral/libupm/examples/java/LDT0028Sample.java deleted file mode 100644 index 0d3970e..0000000 --- a/peripheral/libupm/examples/java/LDT0028Sample.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class LDT0028Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - - // Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0 - upm_ldt0028.LDT0028 sensor = new upm_ldt0028.LDT0028(0); - - System.out.println("Sensor name: " + sensor.name()); - - while (true) { - System.out.println("Sample value: " + sensor.getSample()); - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/LSM303Sample.java b/peripheral/libupm/examples/java/LSM303Sample.java deleted file mode 100644 index 3644e02..0000000 --- a/peripheral/libupm/examples/java/LSM303Sample.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class LSM303Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate LSM303 compass on I2C - upm_lsm303.LSM303 sensor = new upm_lsm303.LSM303(0); - - // Get the coordinate data - sensor.getCoordinates(); - short[] coor = sensor.getRawCoorData(); // in XYZ order.· - // The sensor returns XZY, but the driver compensates and makes it XYZ - - // Print out the X, Y, and Z coordinate data using two different methods - System.out.println("coor: rX " + coor[0] + " - rY " + coor[1] + " - rZ " + coor[2]); - System.out.println("coor: gX " + sensor.getCoorX() + " - gY " + sensor.getCoorY() - + " - gZ " + sensor.getCoorZ()); - - // Get and print out the heading - System.out.println("heading: " + sensor.getHeading()); - - // Get the acceleration - sensor.getAcceleration(); - short[] accel = sensor.getRawAccelData(); - - // Print out the X, Y, and Z acceleration data using two different - // methods - System.out.println("acc: rX " + accel[0] + " - rY " + accel[1] + " - rZ " + accel[2]); - System.out.println("acc: gX " + sensor.getAccelX() + " - gY " + sensor.getAccelY() - + " - gZ " + sensor.getAccelZ()); - - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Lcm1602_i2cSample.java b/peripheral/libupm/examples/java/Lcm1602_i2cSample.java deleted file mode 100644 index 53b8ba4..0000000 --- a/peripheral/libupm/examples/java/Lcm1602_i2cSample.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class Lcm1602_i2cSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_i2clcd.Lcm1602 lcd = new upm_i2clcd.Lcm1602(0, 0x27); - - lcd.setCursor(0, 0); - lcd.write("Hello World"); - Thread.sleep(3000); - - lcd.setCursor(1, 2); - lcd.write("Hello World"); - Thread.sleep(3000); - - lcd.setCursor(2, 4); - lcd.write("Hello World"); - Thread.sleep(3000); - - lcd.setCursor(3, 6); - lcd.write("Hello World"); - Thread.sleep(3000); - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Lcm1602_parallelSample.java b/peripheral/libupm/examples/java/Lcm1602_parallelSample.java deleted file mode 100644 index e720d23..0000000 --- a/peripheral/libupm/examples/java/Lcm1602_parallelSample.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class Lcm1602_parallelSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // LCD connection: - // LCD RS pin to digital pin 8 - // LCD Enable pin to digital pin 13 - // LCD D4 pin to digital pin 2 - // LCD D5 pin to digital pin 3 - // LCD D6 pin to digital pin 4 - // LCD D7 pin to digital pin 5 - // LCD R/W pin to ground - // 10K trimmer potentiometer: - // ends to +5V and ground - // wiper to LCD VO pin (pin 3) - upm_i2clcd.Lcm1602 lcd = new upm_i2clcd.Lcm1602((short) 8, (short) 13, (short) 2, (short) 3, (short) 4, (short) 5, (short) 20, (short) 2); - - lcd.setCursor(0, 0); - lcd.write("Hello World"); - lcd.setCursor(1, 2); - lcd.write("Hello World"); - - System.out.println("Sleeping for 5 seconds"); - Thread.sleep(5000); - // ! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/LoLSample.java b/peripheral/libupm/examples/java/LoLSample.java deleted file mode 100644 index c37a6ca..0000000 --- a/peripheral/libupm/examples/java/LoLSample.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class LoLSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_lol.LoL sensor = new upm_lol.LoL(); - - int x = 0, y = 0; - while (true) { - // revert pixel - sensor.setPixel(x, y, sensor.getPixel(x, y)); - - if (++x == 13) { - x = 0; - y++; - } - if (y == 9) - y = 0; - Thread.sleep(10); - } - // ! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/LoL_exampleSample.java b/peripheral/libupm/examples/java/LoL_exampleSample.java deleted file mode 100644 index b6d2bf3..0000000 --- a/peripheral/libupm/examples/java/LoL_exampleSample.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class LoL_exampleSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_lol.LoL sensor = new upm_lol.LoL(); - - int x = 0, y = 0; - while (true) { - // revert pixel - sensor.setPixel(x, y, sensor.getPixel(x, y)); - - if (++x == 13) { - x = 0; - y++; - } - if (y == 9) - y = 0; - Thread.sleep(10); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/M24LR64ESample.java b/peripheral/libupm/examples/java/M24LR64ESample.java deleted file mode 100644 index a0152a1..0000000 --- a/peripheral/libupm/examples/java/M24LR64ESample.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class M24LR64ESample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate an M24LR64E on I2C bus 0 - upm_m24lr64e.M24LR64E nfcTag = new upm_m24lr64e.M24LR64E(0); - - // This example accesses the device in the 'user' (default) mode, - // reads the last byte of data in the EEPROM, inverts it, writes - // it back, and then re-reads it. - - // Read the last byte of the EEPROM area - int addr = upm_m24lr64e.M24LR64E.EEPROM_I2C_LENGTH - 1; - System.out.println("Address: " + addr); - short read = nfcTag.readByte(addr); - System.out.println("Read: " + read); - - // Now change it to it's opposite and write it - read = (short) (~read & 0xff); - nfcTag.writeByte(addr, read); - System.out.println("Wrote: " + read); - - // Now read it back - read = nfcTag.readByte(addr); - System.out.println("Read: " + read); - - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MAX44000Sample.java b/peripheral/libupm/examples/java/MAX44000Sample.java deleted file mode 100644 index 67e7e03..0000000 --- a/peripheral/libupm/examples/java/MAX44000Sample.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class MAX44000Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_max44000.MAX44000 sensor = new upm_max44000.MAX44000(0); - - while (true) { - System.out.println("proximity value = " + sensor.getAmbient()); - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MHZ16Sample.java b/peripheral/libupm/examples/java/MHZ16Sample.java deleted file mode 100644 index 9059a23..0000000 --- a/peripheral/libupm/examples/java/MHZ16Sample.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class MHZ16Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a MHZ16 serial CO2 sensor on uart 0. - upm_mhz16.MHZ16 co2 = new upm_mhz16.MHZ16(0); - - System.out.println("Make sure that the sensor has had at least 3 minutes to warm up"); - System.out.println("or you will not get valid results."); - System.out.println("The temperature reported is not the ambient temperature,"); - System.out.println("but rather the temperature of the sensor elements."); - - while (true) { - if (!co2.getData()) { - System.out.println("Failed to retrieve data"); - continue; - } - System.out.println("CO2 concentration: " + co2.getGas() + "PPM, Temperature (in C): " - + co2.getTemperature()); - - Thread.sleep(2000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MMA7455Sample.java b/peripheral/libupm/examples/java/MMA7455Sample.java deleted file mode 100644 index 08ee897..0000000 --- a/peripheral/libupm/examples/java/MMA7455Sample.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class MMA7455Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_mma7455.MMA7455 sensor = new upm_mma7455.MMA7455(0); - short[] val; - - while (true) { - val = sensor.readData(); - System.out.println("Accelerometer X: " + val[0] + ", Y: " + val[1] + ", Z: " + val[2]); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MMA7660Sample.java b/peripheral/libupm/examples/java/MMA7660Sample.java deleted file mode 100644 index 77736e2..0000000 --- a/peripheral/libupm/examples/java/MMA7660Sample.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class MMA7660Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate an MMA7660 on I2C bus 0 - upm_mma7660.MMA7660 accel = new upm_mma7660.MMA7660(0); - - // place device in standby mode so we can write registers - accel.setModeStandby(); - - // enable 64 samples per second - accel.setSampleRate(upm_mma7660.MMA7660.MMA7660_AUTOSLEEP_T.AUTOSLEEP_64); - - // place device into active mode - accel.setModeActive(); - - while (true) { - int[] rawValues = accel.getRawValues(); - System.out.println("Raw Values: x = " + rawValues[0] + " y = " + rawValues[1] + " x = " - + rawValues[2]); - - float[] acceleration = accel.getAcceleration(); - System.out.println("Raw Values: x = " + acceleration[0] + " y = " + acceleration[1] - + " x = " + acceleration[2]); - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MPL3115A2Sample.java b/peripheral/libupm/examples/java/MPL3115A2Sample.java deleted file mode 100644 index 8f5b877..0000000 --- a/peripheral/libupm/examples/java/MPL3115A2Sample.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class MPL3115A2Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a MPL3115A2 sensor on I2C - upm_mpl3115a2.MPL3115A2 sensor = new upm_mpl3115a2.MPL3115A2(0); - - while (true) { - System.out.println("Pressure: " + sensor.getPressure()); - System.out.println("Altitude: " + sensor.getAltitude()); - System.out.println("Sealevel pressure: " + sensor.getSealevelPressure()); - System.out.println("Temperature: " + sensor.getTemperature()); - System.out.println(); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MPR121Sample.java b/peripheral/libupm/examples/java/MPR121Sample.java deleted file mode 100644 index 37128b1..0000000 --- a/peripheral/libupm/examples/java/MPR121Sample.java +++ /dev/null @@ -1,34 +0,0 @@ -public class MPR121Sample { - - private static void printButtons(upm_mpr121.MPR121 touch) { - boolean buttonPresed = false; - - System.out.print("Buttons pressed: "); - for (int i = 0; i < 12; i++) { - if ((touch.getM_buttonStates() & (1 << i)) != 0) { - System.out.print(i + " "); - buttonPresed = true; - } - } - - if (!buttonPresed) - System.out.print("None "); - - System.out.println(); - } - - public static void main(String[] args) throws InterruptedException { - // Instantiate an MPR121 on I2C bus 0 - upm_mpr121.MPR121 touch = new upm_mpr121.MPR121(0); - - // init according to AN3944 defaults - touch.configAN3944(); - - while (true) { - touch.readButtons(); - printButtons(touch); - Thread.sleep(1000); - } - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MPU9150Sample.java b/peripheral/libupm/examples/java/MPU9150Sample.java deleted file mode 100644 index a8de875..0000000 --- a/peripheral/libupm/examples/java/MPU9150Sample.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class MPU9150Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_mpu9150.MPU9150 sensor = new upm_mpu9150.MPU9150(); - - sensor.init(); - - while (true) { - sensor.update(); - - 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]); - - float[] magn = sensor.getMagnetometer(); - System.out.println("Magnetometer: " + "MX: " + magn[0] + " MY: " + magn[1] + " MZ: " - + magn[2]); - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MQ2Sample.java b/peripheral/libupm/examples/java/MQ2Sample.java deleted file mode 100644 index fbad70a..0000000 --- a/peripheral/libupm/examples/java/MQ2Sample.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class MQ2Sample { - private static final short resolution = 5; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - short[] buffer = new short[128]; - - // Attach gas sensor to A0 - upm_gas.MQ2 sensor = new upm_gas.MQ2(0); - - upm_gas.thresholdContext ctx = new upm_gas.thresholdContext(); - ctx.setAverageReading(0); - ctx.setRunningAverage(0); - ctx.setAveragedOver(2); - - while (true) { - int len = sensor.getSampledWindow(2, buffer); - - if (len != 0) { - int thresh = sensor.findThreshold(ctx, 30, buffer); - sensor.printGraph(ctx, resolution); - if (thresh != 0) { - System.out.println("---Threshold reached---"); - } - } - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MQ303ASample.java b/peripheral/libupm/examples/java/MQ303ASample.java deleted file mode 100644 index 13365b4..0000000 --- a/peripheral/libupm/examples/java/MQ303ASample.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class MQ303ASample { - - public static void main(String[] args) throws InterruptedException { - // Instantiate an mq303a sensor on analog pin A0 - - // This device uses a heater powered from an analog I/O pin.· - // If using A0 as the data pin, then you need to use A1, as the heater - // pin (if using a grove mq303a). For A1, we can use the D15 gpio,· - // setup as an output, and drive it low to power the heater. - upm_mq303a.MQ303A mq303a = new upm_mq303a.MQ303A(1, 15); - - System.out.println("Enabling heater and waiting 2 minutes for warmup."); - mq303a.heaterEnable(true); - Thread.sleep(120000); - - System.out.println("This sensor may need to warm until the value drops below about 450."); - - for (int i = 1; i < 10; i++) { - int val = mq303a.value(); - System.out.println("Alcohol detected (higher means stronger alcohol): " + val); - - Thread.sleep(1000); - } - - mq303a.heaterEnable(false); - System.out.println("Exiting"); - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MQ5Sample.java b/peripheral/libupm/examples/java/MQ5Sample.java deleted file mode 100644 index c2ae23d..0000000 --- a/peripheral/libupm/examples/java/MQ5Sample.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class MQ5Sample { - private static final short resolution = 7; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - short[] buffer = new short[128]; - - // Attach gas sensor to A0 - upm_gas.MQ5 sensor = new upm_gas.MQ5(0); - - upm_gas.thresholdContext ctx = new upm_gas.thresholdContext(); - ctx.setAverageReading(0); - ctx.setRunningAverage(0); - ctx.setAveragedOver(2); - - while (true) { - int len = sensor.getSampledWindow(2, buffer); - - if (len != 0) { - int thresh = sensor.findThreshold(ctx, 30, buffer); - sensor.printGraph(ctx, resolution); - if (thresh != 0) { - System.out.println("---Threshold reached---"); - } - } - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/MicrophoneSample.java b/peripheral/libupm/examples/java/MicrophoneSample.java deleted file mode 100644 index d59fc32..0000000 --- a/peripheral/libupm/examples/java/MicrophoneSample.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class MicrophoneSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - short[] buffer = new short[128]; - - // Attach microphone to analog port A0 - upm_mic.Microphone sensor = new upm_mic.Microphone(0); - - upm_mic.thresholdContext ctx = new upm_mic.thresholdContext(); - ctx.setAverageReading(0); - ctx.setRunningAverage(0); - ctx.setAveragedOver(2); - - // Repeatedly, take a sample every 2 microseconds; - // find the average of 128 samples; and - // print a running graph of the averages - while (true) { - int len = sensor.getSampledWindow(2, buffer); - - if (len != 0) { - int thresh = sensor.findThreshold(ctx, 30, buffer); - sensor.printGraph(ctx); - if (thresh != 0) { - System.out.println("---Threshold reached--- " + ctx.getRunningAverage() + " " - + ctx.getAverageReading()); - } - } - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/NRF24L01_receiverSample.java b/peripheral/libupm/examples/java/NRF24L01_receiverSample.java deleted file mode 100644 index c5dc481..0000000 --- a/peripheral/libupm/examples/java/NRF24L01_receiverSample.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_nrf24l01.Callback; - -//NOT TESTED!!! -public class NRF24L01_receiverSample { - - static private final byte[] local_address = {0x01, 0x01, 0x01, 0x01, 0x01}; - static private final byte[] broadcast_address = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, - (byte) 0xFF, (byte) 0xFF}; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_nrf24l01.NRF24L01 comm = new upm_nrf24l01.NRF24L01((short) 7, (short) 8); - - Callback callback = new ReceiverCallback(comm); - - comm.setSourceAddress(local_address); - comm.setDestinationAddress(broadcast_address); - comm.setPayload((short) upm_nrf24l01.javaupm_nrf24l01Constants.MAX_BUFFER); - comm.configure(); - comm.setSpeedRate(upm_nrf24l01.speed_rate_t.NRF_250KBPS); - comm.setChannel((short) 99); - comm.setDataReceivedHandler(callback); - - while (true) { - comm.pollListener(); - } - - // ! [Interesting] - } -} - -class ReceiverCallback extends Callback { - - private upm_nrf24l01.NRF24L01 comm = null; - - public ReceiverCallback(upm_nrf24l01.NRF24L01 comm) { - super(); - this.comm = comm; - } - public void run() { - if (comm != null) { - short[] rx_buffer = comm.getM_rxBuffer(); - System.out.print("Received: "); - for (int i = 0; i < rx_buffer.length; i++) - System.out.print(rx_buffer[i]); - System.out.println(); - } else { - System.out.println("No NRF24L01 instance given to callback"); - } - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/NRF24L01_transmitterSample.java b/peripheral/libupm/examples/java/NRF24L01_transmitterSample.java deleted file mode 100644 index f2918f0..0000000 --- a/peripheral/libupm/examples/java/NRF24L01_transmitterSample.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_nrf24l01.Callback; - -//NOT TESTED!!! -public class NRF24L01_transmitterSample { - - static private final byte[] destAddress = {0x01, 0x01, 0x01, 0x01, 0x01}; - static private final byte[] srcAddress = {0x01, 0x01, 0x01, 0x01, 0x01}; - static private byte[] tx_buffer = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, - 0x00}; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_nrf24l01.NRF24L01 comm = new upm_nrf24l01.NRF24L01((short) 7, (short) 8); - - Callback callback = new TransmitterCallback(); - - comm.setSourceAddress(srcAddress); - comm.setDestinationAddress(destAddress); - comm.setPayload((short) upm_nrf24l01.javaupm_nrf24l01Constants.MAX_BUFFER); - comm.setChannel((short) 99); - comm.configure(); - comm.setDataReceivedHandler(callback); - - while (true) { - comm.send(tx_buffer); - System.out.println("devi2 :: sending data ...."); - for (int i = 0; i < tx_buffer.length; i++) - System.out.print(tx_buffer[i]); - System.out.println(); - Thread.sleep(3000); - } - // ! [Interesting] - } -} - -class TransmitterCallback extends Callback { - public TransmitterCallback() { - super(); - } - public void run() { - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/NUNCHUCKSample.java b/peripheral/libupm/examples/java/NUNCHUCKSample.java deleted file mode 100644 index 0a26d99..0000000 --- a/peripheral/libupm/examples/java/NUNCHUCKSample.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class NUNCHUCKSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a nunchuck controller bus 0 - upm_nunchuck.NUNCHUCK nunchuck = new upm_nunchuck.NUNCHUCK(0); - - // always do this first - System.out.println("Initializing... "); - if (!nunchuck.init()) { - System.err.println("nunchuck->init() failed."); - return; - } - - while (true) { - nunchuck.update(); - System.out.println("stickX: " + nunchuck.getStickX() + ", stickY: " - + nunchuck.getStickY()); - System.out.println("accelX: " + nunchuck.getAccelX() + ", accelY: " - + nunchuck.getAccelY() + ", accelZ: " + nunchuck.getAccelZ()); - - if (nunchuck.getButtonC()) - System.out.println("Button C pressed"); - else - System.out.println("Button C not pressed"); - - if (nunchuck.getButtonZ()) - System.out.println("Button Z pressed"); - else - System.out.println("Button Z not pressed"); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/OTP538USample.java b/peripheral/libupm/examples/java/OTP538USample.java deleted file mode 100644 index 07b3ba9..0000000 --- a/peripheral/libupm/examples/java/OTP538USample.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class OTP538USample { - private static final float OTP538U_AREF = 5; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a OTP538U on analog pins A0 and A1 - // A0 is used for the Ambient Temperature and A1 is used for the Object - // temperature. - upm_otp538u.OTP538U temps = new upm_otp538u.OTP538U(0, 1, OTP538U_AREF); - - while (true) { - System.out.println("Ambient temp: " + temps.ambientTemperature() + " C"); - System.out.println("Object temp: " + temps.objectTemperature() + " C"); - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/PPD42NSSample.java b/peripheral/libupm/examples/java/PPD42NSSample.java deleted file mode 100644 index 78d0628..0000000 --- a/peripheral/libupm/examples/java/PPD42NSSample.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class PPD42NSSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a dust sensor on GPIO pin D8 - upm_ppd42ns.PPD42NS dust = new upm_ppd42ns.PPD42NS(8); - upm_ppd42ns.dustData data; - - System.out.println("This program will give readings every 30 seconds until you stop it"); - - while (true) { - data = dust.getData(); - - System.out.println("Low pulse occupancy: " + data.getLowPulseOccupancy()); - System.out.println("Ratio: " + data.getRatio()); - System.out.println("Concentration: " + data.getConcentration()); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/PulsensorSample.java b/peripheral/libupm/examples/java/PulsensorSample.java deleted file mode 100644 index fb1e85b..0000000 --- a/peripheral/libupm/examples/java/PulsensorSample.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Author: Andrei Vasiliu <andrei.vasiliu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_pulsensor.*; - -public class PulsensorSample { - static class PulsensorCallback extends Callback { - public PulsensorCallback() { - super(); - } - public void run (clbk_data arg) { - System.out.println(); - } - } - - public static void main (String[] args) throws InterruptedException { - // ! [Interesting] - Callback obj_call = new PulsensorCallback(); - Pulsensor p = new Pulsensor(obj_call); - p.start_sampler(); - Thread.sleep(1000); - p.stop_sampler(); - // ! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/RFR359FSample.java b/peripheral/libupm/examples/java/RFR359FSample.java deleted file mode 100644 index 0c286de..0000000 --- a/peripheral/libupm/examples/java/RFR359FSample.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class RFR359FSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate an RFR359F digital pin D2 - upm_rfr359f.RFR359F dInterruptor = new upm_rfr359f.RFR359F(2); - - while (true) { - if (dInterruptor.objectDetected()) { - System.out.println("Object detected"); - } else { - System.out.println("Area is clear!"); - } - - Thread.sleep(100); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/RPR220Sample.java b/peripheral/libupm/examples/java/RPR220Sample.java deleted file mode 100644 index ae76be6..0000000 --- a/peripheral/libupm/examples/java/RPR220Sample.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class RPR220Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // This example uses a simple method to determine current status - - // Instantiate an RPR220 digital pin D2 - upm_rpr220.RPR220 sensor = new upm_rpr220.RPR220(2); - - while (true) { - if (sensor.blackDetected()) - System.out.println("Black detected"); - else - System.out.println("Black NOT detected"); - - Thread.sleep(100); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/RPR220_intrSample.java b/peripheral/libupm/examples/java/RPR220_intrSample.java deleted file mode 100644 index 1ea80b4..0000000 --- a/peripheral/libupm/examples/java/RPR220_intrSample.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class RPR220_intrSample { - - public static int counter = 0; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // This example uses an interrupt handler to increment a counter - - // Instantiate an RPR220 digital pin D2 - upm_rpr220.RPR220 sensor = new upm_rpr220.RPR220(2); - - RPRISR callback = new RPRISR(); - sensor.installISR(callback); - - while (true) { - System.out.println("Counter: " + counter); - Thread.sleep(1000); - } - // ! [Interesting] - } -} - -class RPRISR implements Runnable { - public RPRISR() { - super(); - } - public void run() { - RPR220_intrSample.counter++; - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/RotaryEncoderSample.java b/peripheral/libupm/examples/java/RotaryEncoderSample.java deleted file mode 100644 index 8272f57..0000000 --- a/peripheral/libupm/examples/java/RotaryEncoderSample.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class RotaryEncoderSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Grove Rotary Encoder, using signal pins D2 and D3 - upm_rotaryencoder.RotaryEncoder rotaryencoder = new upm_rotaryencoder.RotaryEncoder(2, 3); - - while (true) { - System.out.println("Position: " + rotaryencoder.position()); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/SSD1308_oledSample.java b/peripheral/libupm/examples/java/SSD1308_oledSample.java deleted file mode 100644 index c7a5bd3..0000000 --- a/peripheral/libupm/examples/java/SSD1308_oledSample.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class SSD1308_oledSample { - - static private final int[] IntelLogo = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, - 192, 192, 224, 224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, - 60, 62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31, 30, 62, 62, 62, 62, - 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240, 224, 224, 224, 192, 128, 128, - 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, - 128, 128, 128, 128, 128, 128, 128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 192, - 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195, 195, 7, 15, 15, 63, 127, - 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0, 0, 0, 0, 0, 0, 128, 192, 192, 240, - 248, 124, 124, 60, 0, 0, 0, 0, 159, 159, 159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 0, 0, 0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128, - 128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128, 128, 128, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 3, 7, 3, 3, - 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255, 255, 255, 0, 0, 224, 248, 252, 252, - 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, - 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, - 255, 255, 255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15, - 15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143, 135, 135, 143, - 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255, 255, 255, 255, 255, 255, - 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 224, 248, 248, 255, 255, 255, 255, - 255, 127, 15, 255, 255, 255, 255, 255, 255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, - 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, - 255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255, 255, 255, 255, - 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231, 231, 231, 199, 135, 0, 0, - 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 224, 240, 248, 248, 252, 254, - 255, 255, 255, 127, 63, 63, 31, 15, 7, 7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, - 240, 192, 192, 128, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, - 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7, 7, 7, - 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7, 7, 3, 3, 3, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15, 31, 127, 127, 127, 255, 255, - 252, 252, 252, 248, 240, 240, 240, 224, 224, 224, 192, 192, 192, 192, 128, 128, 128, - 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, - 192, 192, 192, 224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, - 252, 254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 15, - 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127, 127, 127, 255, 255, 255, 255, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, - 127, 127, 127, 127, 63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, - 3, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0}; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_i2clcd.SSD1308 lcd = new upm_i2clcd.SSD1308(0); - - byte[] image = new byte[IntelLogo.length]; - for (int i = 0; i < IntelLogo.length; i++) - image[i] = (byte) IntelLogo[i]; - - lcd.clear(); - lcd.draw(image); - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/SSD1327_oledSample.java b/peripheral/libupm/examples/java/SSD1327_oledSample.java deleted file mode 100644 index defeea6..0000000 --- a/peripheral/libupm/examples/java/SSD1327_oledSample.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class SSD1327_oledSample { - - static private final int[] SeeedLogo = new int[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x04, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, - 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x03, - 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, - 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, - 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x38, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3E, 0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x07, - 0x80, 0x03, 0xE0, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03, - 0xE0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1, 0xF0, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83, 0xE0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0F, 0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0xE1, 0xE0, 0x07, 0x0F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, - 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E, - 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF8, 0x70, 0x1C, 0x3F, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, - 0xE0, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x3E, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x06, 0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xDF, 0xE1, - 0x9F, 0xEC, 0x7E, 0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF, 0xE1, 0xB9, 0xEC, - 0xE7, 0xE0, 0x61, 0xD8, 0x66, 0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3, 0x7C, - 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86, 0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF, - 0xFF, 0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83, 0xC3, 0x61, 0x18, 0x46, 0x03, - 0x86, 0x18, 0x66, 0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7, 0xF9, 0xFE, 0x1F, - 0xE6, 0x3F, 0x9F, 0xEC, 0xFE, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6, 0x3F, - 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, - 0xF3, 0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7D, 0x9E, 0x68, - 0x20, 0xB2, 0xC8, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E, 0x6F, 0x20, 0xB2, - 0xF9, 0xE7, 0x80, 0x00, 0x00, 0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB, 0x60, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3, 0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00, 0xF8, 0x00, 0x00, - 0x40, 0x40, 0x02, 0x00, 0x00, 0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40, 0x60, - 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70, 0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9, - 0x2C, 0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48, 0x40, 0x62, 0xF9, 0x2C, 0x80, - 0x8C, 0xD2, 0x40, 0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C, 0x80, 0x84, 0xD2, - 0x40, 0x8B, 0x2D, 0x92, 0x48, 0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40, 0x8D, - 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_i2clcd.SSD1327 lcd = new upm_i2clcd.SSD1327(0); - - // If you don't set the display to be white, the seeed logo will appear - // jagged - lcd.setGrayLevel((short) 12); - - byte[] image = new byte[SeeedLogo.length]; - for (int i = 0; i < SeeedLogo.length; i++) - image[i] = (byte) SeeedLogo[i]; - - lcd.draw(image); - - // Simple print hello world - for (short i = 0; i < 12; i++) { - lcd.setCursor(i, 0); - lcd.setGrayLevel(i); - lcd.write("Hello World"); - } - - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/ST7735Sample.java b/peripheral/libupm/examples/java/ST7735Sample.java deleted file mode 100644 index a866e98..0000000 --- a/peripheral/libupm/examples/java/ST7735Sample.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class ST7735Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_st7735.ST7735 lcd = new upm_st7735.ST7735((short) 7, (short) 4, (short) 9, (short) 8); - - lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_RED); - lcd.refresh(); - - lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_CYAN); - lcd.refresh(); - - lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_BLACK); - lcd.refresh(); - - lcd.drawLine((short) 10, (short) 10, (short) 10, (short) 100, - upm_st7735.javaupm_st7735Constants.ST7735_MAGENTA); - lcd.drawLine((short) 20, (short) 20, (short) 10, (short) 100, - upm_st7735.javaupm_st7735Constants.ST7735_YELLOW); - lcd.drawLine((short) 30, (short) 30, (short) 50, (short) 100, - upm_st7735.javaupm_st7735Constants.ST7735_WHITE); - lcd.refresh(); - - lcd.drawPixel((short) 20, (short) 20, upm_st7735.javaupm_st7735Constants.ST7735_GREEN); - lcd.refresh(); - - lcd.drawTriangle((short) 50, (short) 50, (short) 80, (short) 80, (short) 60, (short) 90, - upm_st7735.javaupm_st7735Constants.ST7735_GREEN); - lcd.refresh(); - - lcd.drawCircle((short) 100, (short) 110, (short) 10, - upm_st7735.javaupm_st7735Constants.ST7735_BLUE); - lcd.refresh(); - - lcd.setTextWrap((short) 0); - - lcd.setCursor((short) 0, (short) 30); - lcd.setTextColor(upm_st7735.javaupm_st7735Constants.ST7735_RED, - upm_st7735.javaupm_st7735Constants.ST7735_RED); - lcd.setTextSize((short) 1); - lcd.print("Hello World!"); - - lcd.setCursor((short) 10, (short) 50); - lcd.setTextColor(upm_st7735.javaupm_st7735Constants.ST7735_RED, - upm_st7735.javaupm_st7735Constants.ST7735_YELLOW); - lcd.setTextSize((short) 2); - lcd.print("BIG"); - - lcd.refresh(); - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/StepMotorSample.java b/peripheral/libupm/examples/java/StepMotorSample.java deleted file mode 100644 index 88cbe5a..0000000 --- a/peripheral/libupm/examples/java/StepMotorSample.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class StepMotorSample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_stepmotor.StepMotor sensor = new upm_stepmotor.StepMotor(2, 3); - - while (true) { - System.out.println("One complete rotation forward and back at 60 rpm."); - sensor.setSpeed(60); - sensor.stepForward(200); - Thread.sleep(1000); - sensor.stepBackward(200); - Thread.sleep(1000); - - System.out.println("One complete rotation forward and back at 150 rpm."); - sensor.setSpeed(150); - sensor.stepForward(200); - Thread.sleep(1000); - sensor.stepBackward(200); - Thread.sleep(1000); - - System.out.println("One complete rotation forward and back at 300 rpm."); - sensor.setSpeed(300); - sensor.stepForward(200); - Thread.sleep(1000); - sensor.stepBackward(200); - Thread.sleep(1000); - } - // ! [Interesting] - } -} diff --git a/peripheral/libupm/examples/java/TM1637Sample.java b/peripheral/libupm/examples/java/TM1637Sample.java deleted file mode 100644 index 840b969..0000000 --- a/peripheral/libupm/examples/java/TM1637Sample.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import java.time.LocalDateTime; - -//NOT TESTED!!! -public class TM1637Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // TM1637 on pins 0 (clk) and 1 (dio) - upm_tm1637.TM1637 myDisplay = new upm_tm1637.TM1637(0, 1); - - // Start a box using 7-segment encoding - myDisplay.write(0x39, 0x09, 0x09); - - // Finish box using writeAt function - myDisplay.writeAt(3, ']'); - - // Wait 3 seconds - Thread.sleep(3000); - - LocalDateTime now; - while (true) { - now = LocalDateTime.now(); - int hour = now.getHour(); - int min = now.getMinute(); - int sec = now.getSecond(); - - System.out.println(hour + ":" + min + ":" + sec); - myDisplay.writeString(hour + ":" + min); - - Thread.sleep(1000); - } - // ! [Interesting] - } -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/TP401Sample.java b/peripheral/libupm/examples/java/TP401Sample.java deleted file mode 100644 index 89ac2b1..0000000 --- a/peripheral/libupm/examples/java/TP401Sample.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class TP401Sample { - private static String airQuality(int value) { - if (value < 50) - return "Fresh Air"; - if (value < 200) - return "Normal Indoor Air"; - if (value < 400) - return "Low Pollution"; - if (value < 600) - return "High Pollution - Action Recommended"; - return "Very High Pollution - Take Action Immediately"; - } - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate new grove air quality sensor on analog pin A0 - upm_gas.TP401 airSensor = new upm_gas.TP401(0); - - System.out.println(airSensor.name()); - - System.out.println("Heating sensor for 3 minutes..."); - // wait 3 minutes for sensor to warm up - for (int i = 0; i < 3; i++) { - if (i != 0) - System.out.println("Please wait, " + i + " minute(s) passed.."); - Thread.sleep(60000); - } - System.out.println("Sensor ready!"); - - while (true) { - int value = airSensor.getSample(); // Read raw value - float ppm = airSensor.getPPM(); // Read CO ppm (can vary slightly - // from previous read) - - System.out.println("raw: " + value + " ppm: " + ppm + " " + airQuality(value)); - - Thread.sleep(100); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/TSL2561Sample.java b/peripheral/libupm/examples/java/TSL2561Sample.java deleted file mode 100644 index d366446..0000000 --- a/peripheral/libupm/examples/java/TSL2561Sample.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class TSL2561Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a TSL2561 Digital Light Sensor on I2C - upm_tsl2561.TSL2561 sensor = new upm_tsl2561.TSL2561(); - - while (true) { - System.out.println("Lux = " + sensor.getLux()); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/TTP223Sample.java b/peripheral/libupm/examples/java/TTP223Sample.java deleted file mode 100644 index 394efb5..0000000 --- a/peripheral/libupm/examples/java/TTP223Sample.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class TTP223Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - upm_ttp223.TTP223 touch = new upm_ttp223.TTP223(7); - - while (true) { - if (touch.isPressed()) - System.out.println(touch.name() + " is pressed"); - else - System.out.println(touch.name() + " is not pressed"); - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Th02Example.java b/peripheral/libupm/examples/java/Th02Example.java deleted file mode 100644 index f2a97c4..0000000 --- a/peripheral/libupm/examples/java/Th02Example.java +++ /dev/null @@ -1,59 +0,0 @@ -/* -* Author: Abhishek Malik <abhishek.malik@intel.com> -* Copyright (c) 2016 Intel Corporation. -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -import upm_th02.TH02; - -public class Th02Example { - - static { - try { - System.loadLibrary("javaupm_th02"); - 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 - float temperature = 0; - float humidity = 0; - - TH02 sensor = new TH02(); - while(true){ - temperature = sensor.getTemperature(); - humidity = sensor.getHumidity(); - System.out.println("Temperature = "+temperature+", Humidity = "+humidity); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - System.out.println("The following exception has occured: "+e.getMessage()); - } - } - } - -} diff --git a/peripheral/libupm/examples/java/ULN200XASample.java b/peripheral/libupm/examples/java/ULN200XASample.java deleted file mode 100644 index 81f97ad..0000000 --- a/peripheral/libupm/examples/java/ULN200XASample.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class ULN200XASample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Stepper motor on a ULN200XA Dual H-Bridge. - // Wire the pins so that I1 is pin D8, I2 is pin D9, I3 is pin D10 and - // I4 is pin D11 - upm_uln200xa.ULN200XA uln200xa = new upm_uln200xa.ULN200XA(4096, 8, 9, 10, 11); - - uln200xa.setSpeed(5); - System.out.println("Rotating 1 revolution clockwise."); - uln200xa.setDirection(upm_uln200xa.ULN200XA.ULN200XA_DIRECTION_T.DIR_CW); - uln200xa.stepperSteps(4096); - - System.out.println("Sleeping for 2 seconds..."); - Thread.sleep(2000); - - System.out.println("Rotating 1/2 revolution counter clockwise."); - uln200xa.setDirection(upm_uln200xa.ULN200XA.ULN200XA_DIRECTION_T.DIR_CCW); - uln200xa.stepperSteps(2048); - - // turn off the power - uln200xa.release(); - // ! [Interesting] - - System.out.println("Exiting..."); - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/Ublox6Sample.java b/peripheral/libupm/examples/java/Ublox6Sample.java deleted file mode 100644 index b7c5017..0000000 --- a/peripheral/libupm/examples/java/Ublox6Sample.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class Ublox6Sample { - private static final int BUFFERLENGTH = 256; - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a Ublox6 GPS device on uart 0 - upm_ublox6.Ublox6 nmea = new upm_ublox6.Ublox6(0); - - // make sure port is initialized properly. 9600 baud is the default. - if (!nmea.setupTty()) { - throw new RuntimeException("Failed to setup tty port parameters"); - } - - // Collect and output NMEA data. There are various libraries out on - // the Internet, that can handle decoding NMEA data and presenting - // it in a more easily accessible format. This example will just - // check for, and read raw NMEA data from the device and output it - // on standard output. - - // This device also supports numerous configuration options, which - // you can set with writeData(). Please refer to the Ublox-6 data - // sheet for further information on the formats of the data sent and - // received, and the various operating modes available. - - byte[] nmeaBuffer = new byte[BUFFERLENGTH]; - - while (true) { - // we don't want the read to block in this example, so always - // check to see if data is available first. - if (nmea.dataAvailable()) { - int rv = nmea.readData(nmeaBuffer); - - if (rv > 0) - for (int i = 0; i < rv; i++) - System.out.print((char) nmeaBuffer[i]); - - if (rv < 0) { // some sort of read error occurred - System.err.println("Port read error."); - break; - } - continue; - } - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/WT5001Sample.java b/peripheral/libupm/examples/java/WT5001Sample.java deleted file mode 100644 index 2266b3d..0000000 --- a/peripheral/libupm/examples/java/WT5001Sample.java +++ /dev/null @@ -1,130 +0,0 @@ -import java.io.IOException; - -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class WT5001Sample { - - static private void printUsage() { - System.out.println("Usage: java WT5001Sample <command>"); - System.out.println("Commands:"); - System.out.println("0 - stop playing"); - System.out.println("1 - start playing track 1"); - System.out.println("2 - pause/un-pause playback"); - System.out.println("3 - next track"); - System.out.println("4 - previous track"); - } - - public static void main(String[] args) { - // ! [Interesting] - // Instantiate a WT5001 serial MP3 player on uart 0 - upm_wt5001.WT5001 mp3 = new upm_wt5001.WT5001(0); - - int cmd = -1; - if (args.length > 0) - cmd = Integer.parseInt(args[0]); - - // make sure port is initialized properly. 9600 baud is the default - if (!mp3.setupTty()) { - System.err.println("error in loading native library"); - System.exit(-1); - } - - switch (cmd) { - case 0 : - mp3.stop(); - break; - - case 1 : - mp3.play(upm_wt5001.WT5001.WT5001_PLAYSOURCE_T.SD, 1); - break; - - case 2 : - mp3.pause(); - break; - - case 3 : - mp3.next(); - break; - - case 4 : - mp3.previous(); - break; - - default : - // nothing, just output usage, and info below - printUsage(); - break; - } - - // print out some information - try { - short vol; - vol = mp3.getVolume(); - System.out.println("The current volume is: " + vol); - } catch (IOException e) { - e.printStackTrace(); - } - - try { - short ps; - ps = mp3.getPlayState(); - System.out.println("The current play state is: " + ps); - } catch (IOException e) { - e.printStackTrace(); - } - - try { - int numf; - numf = mp3.getNumFiles(upm_wt5001.WT5001.WT5001_PLAYSOURCE_T.SD); - System.out.println("The number of files on the SD card is: " + numf); - } catch (IOException e) { - e.printStackTrace(); - } - - try { - int curf; - curf = mp3.getCurrentFile(); - System.out.println("The current file is: " + curf); - } catch (IOException e) { - e.printStackTrace(); - } - - int year[] = new int[1]; - short month[] = new short[1]; - short day[] = new short[1]; - if (mp3.getDate(year, month, day)) - System.out.println("The device date is: " + year[0] + "/" + month[0] + "/" + day[0]); - - short hour[] = new short[1]; - short minute[] = new short[1]; - short second[] = new short[1]; - if (mp3.getTime(hour, minute, second)) - System.out - .println("The device time is: " + hour[0] + ":" + minute[0] + ":" + second[0]); - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/WaterLevelSensor.java b/peripheral/libupm/examples/java/WaterLevelSensor.java deleted file mode 100644 index d08aaee..0000000 --- a/peripheral/libupm/examples/java/WaterLevelSensor.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Author: Abhishek Malik <abhishek.malik@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import upm_waterlevel.WaterLevel; - -public class WaterLevelSensor { - - public static void main(String[] args) { - // TODO Auto-generated method stub - //! [Interesting] - // Instantiating the sensor on Digital Pin 2 - WaterLevel level = new WaterLevel(2); - - while(true){ - if(level.isSubmerged()){ - System.out.println("The sensor is submerged"); - } - else{ - System.out.println("The sensor is above water level"); - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - System.out.println("The following exception occured: "+e.getMessage()); - } - } - //! [Interesting] - } - -} diff --git a/peripheral/libupm/examples/java/YG1006Sample.java b/peripheral/libupm/examples/java/YG1006Sample.java deleted file mode 100644 index b994829..0000000 --- a/peripheral/libupm/examples/java/YG1006Sample.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class YG1006Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a yg1006 flame sensor on digital pin D2 - upm_yg1006.YG1006 flame = new upm_yg1006.YG1006(2); - - while (true) { - boolean val = flame.flameDetected(); - if (val) { - System.out.println("Flame detected"); - } else { - System.out.println("No flame detected"); - } - - Thread.sleep(1000); - } - // ! [Interesting] - } - -}
\ No newline at end of file diff --git a/peripheral/libupm/examples/java/ZFM20Sample.java b/peripheral/libupm/examples/java/ZFM20Sample.java deleted file mode 100644 index 3a36b84..0000000 --- a/peripheral/libupm/examples/java/ZFM20Sample.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: Stefan Andritoiu <stefan.andritoiu@intel.com> - * Copyright (c) 2015 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -//NOT TESTED!!! -public class ZFM20Sample { - - public static void main(String[] args) throws InterruptedException { - // ! [Interesting] - // Instantiate a ZFM20 Fingerprint reader on UART 0 - upm_zfm20.ZFM20 fp = new upm_zfm20.ZFM20(0); - - // make sure port is initialized properly. 57600 baud is the default - if (!fp.setupTty()) { - System.err.println("Failed to setup tty port parameters"); - System.exit(-1); - } - - // first, set the default password and address - fp.setPassword(upm_zfm20.javaupm_zfm20.ZFM20_DEFAULT_PASSWORD); - fp.setAddress(upm_zfm20.javaupm_zfm20.ZFM20_DEFAULT_ADDRESS); - - // now verify the password. If this fails, any other commands - // will be ignored, so we just bail. - if (fp.verifyPassword()) { - System.out.println("Password verified."); - } else { - System.err.println("Password verification failed."); - System.exit(-1); - } - - // how many valid stored templates (fingerprints) do we have? - System.out.println("Total stored templates: " + fp.getNumTemplates()); - - // now spin waiting for a fingerprint to successfully image - System.out.println("Waiting for finger print..."); - while (fp.generateImage() == upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_NO_FINGER.swigValue()); - - // in theory, we have an image - System.out.println("Image captured, converting..."); - short rv = fp.image2Tz(1); - if (rv != upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_OK.swigValue()) { - System.err.println("Image conversion failed with error code " + rv); - System.exit(-1); - } - System.out.println("Image conversion succeeded"); - - // we search for a print matching slot 1, where we shored our last - // converted fingerprint - int[] id = new int[1]; - int[] score = new int[1]; - rv = fp.search(1, id, score); - if (rv != upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_OK.swigValue()) { - if (rv == upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_FP_NOTFOUND.swigValue()) { - System.out.println("Fingerprint not found"); - System.exit(0); - } else { - System.err.println("Search failed with error code " + rv); - System.exit(-1); - } - } - - System.out.println("Fingerprint found!"); - System.out.println("ID: " + id[0] + ", Score: " + score[0]); - - // ! [Interesting] - } -}
\ No newline at end of file |