mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 17:31:13 +03:00
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 <noel.eck@intel.com>
This commit is contained in:
@ -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]
|
||||
}
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
// ! [Interesting]
|
||||
}
|
||||
}
|
||||
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user