From 3ab74be66b64b8fc23834e97a9d0a06670cd87b2 Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Fri, 9 Sep 2016 17:26:58 -0700 Subject: [PATCH] grove: Updated java/script tests for light and slide sensor. Since these were split out from the grove lib, they need to load their own library, ie Light now comes from upm_light.so. Signed-off-by: Noel Eck --- examples/java/LightSample.java | 26 +++++++++++++------------- examples/java/SlideSample.java | 30 +++++++++++++++--------------- examples/javascript/light.js | 6 +++--- examples/javascript/slide.js | 4 ++-- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/examples/java/LightSample.java b/examples/java/LightSample.java index 40c2b7a2..1a6a122f 100644 --- a/examples/java/LightSample.java +++ b/examples/java/LightSample.java @@ -23,19 +23,19 @@ */ public class LightSample { - public static void main(String args[]) throws InterruptedException { - // ! [Interesting] - upm_grove.Light gl = new upm_grove.Light(2); + public static void main(String args[]) throws InterruptedException { + // ! [Interesting] + upm_light.Light gl = new upm_light.Light(2); - while (true) { - float raw_value = gl.raw_value(); - float value = gl.value(); + while (true) { + float raw_value = gl.raw_value(); + float value = gl.value(); - System.out.println("raw value: " + raw_value); - System.out.println("value: " + value); + System.out.println("raw value: " + raw_value); + System.out.println("value: " + value); - Thread.sleep(1000); - } - // ! [Interesting] - } -} \ No newline at end of file + Thread.sleep(1000); + } + // ! [Interesting] + } +} diff --git a/examples/java/SlideSample.java b/examples/java/SlideSample.java index a07213dd..32314519 100644 --- a/examples/java/SlideSample.java +++ b/examples/java/SlideSample.java @@ -23,20 +23,20 @@ */ public class SlideSample { - public static void main (String args[]) throws InterruptedException { - //! [Interesting] - // Instantiate new grove slide potentiometer on analog pin A0 - upm_grove.Slide slide = new upm_grove.Slide(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); - } + public static void main (String args[]) throws InterruptedException { //! [Interesting] - } + // Instantiate new grove slide potentiometer on analog pin A0 + upm_slide.Slide slide = new upm_slide.Slide(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/examples/javascript/light.js b/examples/javascript/light.js index 36e4b74f..9ce63a1f 100644 --- a/examples/javascript/light.js +++ b/examples/javascript/light.js @@ -22,11 +22,11 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -// Load Grove module -var groveSensor = require('jsupm_grove'); +// Load light module +var sensor = require('jsupm_light'); // Create the light sensor object using AIO pin 0 -var light = new groveSensor.Light(0); +var light = new sensor.Light(0); // Read the input and print both the raw value and a rough lux value, // waiting one second between readings diff --git a/examples/javascript/slide.js b/examples/javascript/slide.js index fbbf5f21..14bb6ef6 100644 --- a/examples/javascript/slide.js +++ b/examples/javascript/slide.js @@ -22,10 +22,10 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -var upm_grove = require('jsupm_grove'); +var upm_slide = require('jsupm_slide'); //setup access analog input Analog pin #0 (A0) -var Slide = new upm_grove.Slide(0); +var Slide = new upm_slide.Slide(0); loop();