2015-09-08 21:58:36 +03:00
|
|
|
/*
|
|
|
|
|
* Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
|
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2015-09-08 21:58:36 +03:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2015-09-08 21:58:36 +03:00
|
|
|
*/
|
|
|
|
|
|
2018-02-27 12:12:09 -08:00
|
|
|
public class Slide_Example {
|
2016-09-09 17:26:58 -07:00
|
|
|
public static void main (String args[]) throws InterruptedException {
|
|
|
|
|
//! [Interesting]
|
2015-09-14 18:13:40 +03:00
|
|
|
// Instantiate new grove slide potentiometer on analog pin A0
|
2016-09-09 17:26:58 -07:00
|
|
|
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);
|
2015-08-12 16:44:30 +03:00
|
|
|
|
2016-09-09 17:26:58 -07:00
|
|
|
Thread.sleep(2500);
|
|
|
|
|
}
|
2015-09-14 18:13:40 +03:00
|
|
|
//! [Interesting]
|
2016-09-09 17:26:58 -07:00
|
|
|
}
|
2015-08-12 16:44:30 +03:00
|
|
|
}
|