java: Added [Interesting] delimiters for snippets of code to be inserted in the documentation

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Stefan Andritoiu 2015-09-14 18:13:40 +03:00 committed by Mihai Tudor Panu
parent ef74a7b137
commit 0bc1930cf5
28 changed files with 105 additions and 47 deletions

View File

@ -33,6 +33,8 @@ public class A110xSample {
}
public static void main(String argv[]) throws InterruptedException {
//! [Interesting]
// Instantiate an A110X sensor on digital pin D2
upm_a110x.A110X a110x = new upm_a110x.A110X(2);
while(true) {
@ -43,6 +45,7 @@ public class A110xSample {
System.out.println("magnet not detected...");
}
Thread.sleep(1000);
}
}
//! [Interesting]
}
}

View File

@ -33,6 +33,8 @@ public class Adxl345 {
}
public static void main(String argv[]) throws InterruptedException {
//! [Interesting]
// Note: Sensor only works at 3.3V on the Intel Edison with Arduino breakout
upm_adxl345.Adxl345 obj = new upm_adxl345.Adxl345(0);
int[] raw = new int[3];
float[] accel = new float[3];
@ -49,5 +51,6 @@ public class Adxl345 {
Thread.sleep(1000);
}
//! [Interesting]
}
}

View File

@ -34,6 +34,8 @@ 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) {
@ -46,6 +48,7 @@ public class BISS0001Sample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -34,6 +34,7 @@ public class BuzzerSample{
}
public static void main(String[] args) throws InterruptedException {
//! [Interesting]
int chord[] = {
upm_buzzer.javaupm_buzzer.DO,
upm_buzzer.javaupm_buzzer.RE,
@ -57,8 +58,9 @@ public class BuzzerSample{
Thread.sleep(100);
}
//! [Interesting]
sound.stopSound();
}
}
}

View File

@ -34,6 +34,7 @@ public class CJQ4435Sample{
}
public static void main(String[] args) throws InterruptedException {
//! [Interesting]
// Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
upm_cjq4435.CJQ4435 mosfet = new upm_cjq4435.CJQ4435(3);
@ -56,6 +57,7 @@ public class CJQ4435Sample{
}
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -35,6 +35,7 @@ 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,
@ -58,5 +59,6 @@ public class ES08ASample{
servo.setAngle (180);
System.out.println("Set angle to 180");
//! [Interesting]
}
}
}

View File

@ -29,7 +29,6 @@ public class GUVAS12DSample{
private static final float GUVAS12D_AREF = 5;
private static final int SAMPLES_PER_QUERY = 1024;
static {
try {
System.loadLibrary("javaupm_guvas12d");
@ -40,7 +39,9 @@ public class GUVAS12DSample{
}
public static void main(String[] args) throws InterruptedException {
upm_guvas12d.GUVAS12D volts = new upm_guvas12d.GUVAS12D(3);
//! [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);
@ -49,6 +50,7 @@ public class GUVAS12DSample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -34,6 +34,7 @@ public class GroveButtonSample{
}
public static void main(String[] args) throws InterruptedException {
//! [Interesting]
// Create the button object using UART
upm_grove.GroveButton button = new upm_grove.GroveButton(0);
@ -42,6 +43,7 @@ public class GroveButtonSample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -33,7 +33,8 @@ public class GroveLEDSample {
}
public static void main (String args[]) throws InterruptedException {
upm_grove.GroveLed led = new upm_grove.GroveLed(2);
//! [Interesting]
upm_grove.GroveLed led = new upm_grove.GroveLed(2);
for (int i = 0; i < 10; ++i) {
led.on();
@ -42,5 +43,6 @@ public class GroveLEDSample {
Thread.sleep(1000);
}
led.delete();
//! [Interesting]
}
}

View File

@ -33,7 +33,8 @@ public class GroveLightSample {
}
public static void main (String args[]) throws InterruptedException {
upm_grove.GroveLight gl = new upm_grove.GroveLight(2);
//! [Interesting]
upm_grove.GroveLight gl = new upm_grove.GroveLight(2);
while (true) {
float raw_value = gl.raw_value();
@ -44,5 +45,6 @@ public class GroveLightSample {
Thread.sleep(1000);
}
//! [Interesting]
}
}

View File

@ -34,7 +34,8 @@ public class GroveLineFinderSample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate a Grove Line Finder sensor on digital pin D2
//! [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){
@ -48,6 +49,7 @@ public class GroveLineFinderSample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -33,8 +33,9 @@ public class GroveMoistureSample{
}
public static void main (String args[]) throws InterruptedException {
upm_grovemoisture.GroveMoisture gm = new upm_grovemoisture.GroveMoisture(1);
//! [Interesting]
upm_grovemoisture.GroveMoisture gm = new upm_grovemoisture.GroveMoisture(1);
while (true) {
int moisture_val = gm.value();
String result;
@ -50,5 +51,6 @@ public class GroveMoistureSample{
Thread.sleep(1000);
}
//! [Interesting]
}
}

View File

@ -33,7 +33,8 @@ public class GroveRelaySample{
}
public static void main(String[] args) throws InterruptedException {
// Create the button object using UART
//! [Interesting]
// Create the button object using UART
upm_grove.GroveRelay relay = new upm_grove.GroveRelay(5);
for( int i = 0 ; i < 3 ; i++ ){
@ -47,5 +48,6 @@ public class GroveRelaySample{
System.out.println("Relay is off");
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -34,7 +34,8 @@ public class GroveRotarySample{
}
public static void main(String[] args) throws InterruptedException {
upm_grove.GroveRotary knob = new upm_grove.GroveRotary(0);
//! [Interesting]
upm_grove.GroveRotary knob = new upm_grove.GroveRotary(0);
while (true) {
float abs_value = knob.abs_value(); // Absolute raw value
@ -49,6 +50,7 @@ public class GroveRotarySample{
Thread.sleep(3000);
}
//! [Interesting]
}
}
}

View File

@ -33,7 +33,8 @@ public class GroveSlideSample {
}
public static void main (String args[]) throws InterruptedException {
// Instantiate new grove slide potentiometer on analog pin A0
//! [Interesting]
// Instantiate new grove slide potentiometer on analog pin A0
upm_grove.GroveSlide slide = new upm_grove.GroveSlide(0);
while (true) {
@ -45,5 +46,6 @@ public class GroveSlideSample {
Thread.sleep(2500);
}
//! [Interesting]
}
}

View File

@ -34,7 +34,8 @@ public class GroveSpeakerSample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate a Grove Speaker on digital pin D2
//! [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
@ -42,6 +43,7 @@ public class GroveSpeakerSample{
// Play a medium C-sharp
speaker.playSound('c', true, "med");
}
//! [Interesting]
}
}

View File

@ -33,7 +33,8 @@ public class GroveTempSample {
}
public static void main (String args[]) throws InterruptedException {
upm_grove.GroveTemp temp = new upm_grove.GroveTemp(3);
//! [Interesting]
upm_grove.GroveTemp temp = new upm_grove.GroveTemp(3);
for (int i = 0; i < 10; ++i) {
@ -46,5 +47,6 @@ public class GroveTempSample {
Thread.sleep(1000);
}
temp.delete();
//! [Interesting]
}
}

View File

@ -34,7 +34,8 @@ public class GroveWaterSample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate a Grove Water sensor on digital pin D2
//! [Interesting]
// Instantiate a Grove Water sensor on digital pin D2
upm_grovewater.GroveWater water = new upm_grovewater.GroveWater(2);
while (true) {
@ -48,7 +49,8 @@ public class GroveWaterSample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -34,7 +34,8 @@ public class Jhd1313m1Sample{
}
public static void main(String[] args) throws InterruptedException {
upm_i2clcd.Jhd1313m1 lcd = new upm_i2clcd.Jhd1313m1(1, 0x3E, 0x62);
//! [Interesting]
upm_i2clcd.Jhd1313m1 lcd = new upm_i2clcd.Jhd1313m1(1, 0x3E, 0x62);
lcd.setCursor(0,0);
lcd.write("Hello World");
@ -44,7 +45,7 @@ public class Jhd1313m1Sample{
System.out.println("Sleeping for 5 seconds");
Thread.sleep(5000);
lcd.clear();
//! [Interesting]
}
}
}

View File

@ -34,7 +34,8 @@ public class MQ303ASample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate an mq303a sensor on analog pin A0
//! [Interesting]
// 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
@ -57,6 +58,7 @@ public class MQ303ASample{
mq303a.heaterEnable(false);
System.out.println("Exiting");
}
//! [Interesting]
}
}
}

View File

@ -34,7 +34,8 @@ public class MY9221Sample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate a Grove LED Bar, with Data pin D8 and Clock pin D9
//! [Interesting]
// Instantiate a Grove LED Bar, with Data pin D8 and Clock pin D9
upm_my9221.MY9221 bar = new upm_my9221.MY9221((short) 8, (short) 9);
while (true) {
@ -43,6 +44,7 @@ public class MY9221Sample{
Thread.sleep(100);
}
}
//! [Interesting]
}
}
}

View File

@ -34,7 +34,8 @@ public class NUNCHUCKSample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate a nunchuck controller bus 0
//! [Interesting]
// Instantiate a nunchuck controller bus 0
upm_nunchuck.NUNCHUCK nunchuck = new upm_nunchuck.NUNCHUCK(0);
// always do this first
@ -62,6 +63,7 @@ public class NUNCHUCKSample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -35,7 +35,8 @@ public class OTP538USample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate a OTP538U on analog pins A0 and A1
//! [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);
@ -45,5 +46,6 @@ public class OTP538USample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -34,7 +34,8 @@ public class RFR359FSample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate an RFR359F digital pin D2
//! [Interesting]
// Instantiate an RFR359F digital pin D2
upm_rfr359f.RFR359F dInterruptor = new upm_rfr359f.RFR359F(2);
while(true){
@ -47,6 +48,7 @@ public class RFR359FSample{
Thread.sleep(100);
}
//! [Interesting]
}
}
}

View File

@ -34,7 +34,8 @@ public class RotaryEncoderSample{
}
public static void main(String[] args) throws InterruptedException {
// Create the button object using UART
//! [Interesting]
// Create the button object using UART
upm_rotaryencoder.RotaryEncoder rotaryencoder = new upm_rotaryencoder.RotaryEncoder(2, 3);
while (true) {
@ -42,6 +43,7 @@ public class RotaryEncoderSample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -41,7 +41,8 @@ public class TP401Sample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate new grove air quality sensor on analog pin A0
//! [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());
@ -63,7 +64,8 @@ public class TP401Sample{
Thread.sleep(100);
}
//! [Interesting]
}
}
}

View File

@ -34,7 +34,8 @@ public class TTP223Sample{
}
public static void main(String[] args) throws InterruptedException {
upm_ttp223.TTP223 touch = new upm_ttp223.TTP223(7);
//! [Interesting]
upm_ttp223.TTP223 touch = new upm_ttp223.TTP223(7);
while (true) {
if(touch.isPressed())
@ -44,6 +45,7 @@ public class TTP223Sample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}

View File

@ -34,7 +34,8 @@ public class YG1006Sample{
}
public static void main(String[] args) throws InterruptedException {
// Instantiate a yg1006 flame sensor on digital pin D2
//! [Interesting]
// Instantiate a yg1006 flame sensor on digital pin D2
upm_yg1006.YG1006 flame = new upm_yg1006.YG1006(2);
while (true) {
@ -48,6 +49,7 @@ public class YG1006Sample{
Thread.sleep(1000);
}
//! [Interesting]
}
}
}