Ver código fonte

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>
Stefan Andritoiu 9 anos atrás
pai
commit
0bc1930cf5

+ 4
- 1
examples/java/A110xSample.java Ver arquivo

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

+ 3
- 0
examples/java/Adxl345.java Ver arquivo

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

+ 4
- 1
examples/java/BISS0001Sample.java Ver arquivo

@@ -34,6 +34,8 @@ public class BISS0001Sample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
+//! [Interesting]
38
+        // Instantiate a Grove Motion sensor on GPIO pin D7
37 39
 		upm_biss0001.BISS0001 motion = new upm_biss0001.BISS0001(7);
38 40
 	
39 41
 		while (true) {
@@ -46,6 +48,7 @@ public class BISS0001Sample{
46 48
 			
47 49
 			Thread.sleep(1000);
48 50
 		}
51
+//! [Interesting]
49 52
 	}
50 53
 
51
-}
54
+}

+ 3
- 1
examples/java/BuzzerSample.java Ver arquivo

@@ -34,6 +34,7 @@ public class BuzzerSample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
+        //! [Interesting]
37 38
 		int chord[] = {
38 39
 				upm_buzzer.javaupm_buzzer.DO, 
39 40
 				upm_buzzer.javaupm_buzzer.RE, 
@@ -57,8 +58,9 @@ public class BuzzerSample{
57 58
 			
58 59
 			Thread.sleep(100);
59 60
 		}
61
+        //! [Interesting]
60 62
 		sound.stopSound();
61 63
 	}
62 64
 	
63 65
 
64
-}
66
+}

+ 3
- 1
examples/java/CJQ4435Sample.java Ver arquivo

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

+ 3
- 1
examples/java/ES08ASample.java Ver arquivo

@@ -35,6 +35,7 @@ public class ES08ASample{
35 35
 	}
36 36
 	
37 37
 	public static void main(String[] args) throws InterruptedException {
38
+        //! [Interesting]
38 39
 		upm_servo.ES08A servo = new upm_servo.ES08A(6);
39 40
 		
40 41
 		// Sets the shaft to 180, then to 90, then to 0,
@@ -58,5 +59,6 @@ public class ES08ASample{
58 59
 
59 60
 		servo.setAngle (180);
60 61
 	    System.out.println("Set angle to 180");
62
+        //! [Interesting]
61 63
 	}
62
-}
64
+}

+ 5
- 3
examples/java/GUVAS12DSample.java Ver arquivo

@@ -29,7 +29,6 @@ public class GUVAS12DSample{
29 29
 	private static final float GUVAS12D_AREF = 5;
30 30
 	private static final int SAMPLES_PER_QUERY = 1024;
31 31
 
32
-	
33 32
 	static {
34 33
 		try {
35 34
 			System.loadLibrary("javaupm_guvas12d");
@@ -40,7 +39,9 @@ public class GUVAS12DSample{
40 39
 	}
41 40
 	
42 41
 	public static void main(String[] args) throws InterruptedException {
43
-		upm_guvas12d.GUVAS12D volts = new upm_guvas12d.GUVAS12D(3);
42
+		//! [Interesting]
43
+        // Instantiate a GUVAS12D on analog pin A3
44
+        upm_guvas12d.GUVAS12D volts = new upm_guvas12d.GUVAS12D(3);
44 45
 		
45 46
 		while (true) {
46 47
 			float value = volts.value(GUVAS12D_AREF, SAMPLES_PER_QUERY);
@@ -49,6 +50,7 @@ public class GUVAS12DSample{
49 50
 		
50 51
 			Thread.sleep(1000);
51 52
 		}
53
+        //! [Interesting]
52 54
 	}
53 55
 
54
-}
56
+}

+ 3
- 1
examples/java/GroveButtonSample.java Ver arquivo

@@ -34,6 +34,7 @@ public class GroveButtonSample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
+        //! [Interesting]
37 38
 		// Create the button object using UART
38 39
 		upm_grove.GroveButton button = new upm_grove.GroveButton(0);
39 40
 	
@@ -42,6 +43,7 @@ public class GroveButtonSample{
42 43
 			
43 44
 			Thread.sleep(1000);
44 45
 		}
46
+        //! [Interesting]
45 47
 	}
46 48
 
47
-}
49
+}

+ 3
- 1
examples/java/GroveLEDSample.java Ver arquivo

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

+ 3
- 1
examples/java/GroveLightSample.java Ver arquivo

@@ -33,7 +33,8 @@ public class GroveLightSample {
33 33
 	}
34 34
 
35 35
 	public static void main (String args[]) throws InterruptedException {
36
-		upm_grove.GroveLight gl = new upm_grove.GroveLight(2);
36
+		//! [Interesting]
37
+        upm_grove.GroveLight gl = new upm_grove.GroveLight(2);
37 38
 		
38 39
 		while (true) {
39 40
 			float raw_value = gl.raw_value();
@@ -44,5 +45,6 @@ public class GroveLightSample {
44 45
 			
45 46
 			Thread.sleep(1000);
46 47
 		}
48
+        //! [Interesting]
47 49
 	}
48 50
 }

+ 4
- 2
examples/java/GroveLineFinderSample.java Ver arquivo

@@ -34,7 +34,8 @@ public class GroveLineFinderSample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		// Instantiate a Grove Line Finder sensor on digital pin D2
37
+		//! [Interesting]
38
+        // Instantiate a Grove Line Finder sensor on digital pin D2
38 39
 		upm_grovelinefinder.GroveLineFinder finder = new upm_grovelinefinder.GroveLineFinder(2);
39 40
 		// check every second for the presence of white detection
40 41
 		while(true){
@@ -48,6 +49,7 @@ public class GroveLineFinderSample{
48 49
 
49 50
 			Thread.sleep(1000);
50 51
 		}
52
+        //! [Interesting]
51 53
 	}
52 54
 
53
-}
55
+}

+ 4
- 2
examples/java/GroveMoistureSample.java Ver arquivo

@@ -33,8 +33,9 @@ public class GroveMoistureSample{
33 33
 	}
34 34
 
35 35
 	public static void main (String args[]) throws InterruptedException {
36
-		upm_grovemoisture.GroveMoisture gm = new upm_grovemoisture.GroveMoisture(1);
37
-	
36
+		//! [Interesting]
37
+        upm_grovemoisture.GroveMoisture gm = new upm_grovemoisture.GroveMoisture(1);
38
+
38 39
 		while (true) {
39 40
 			int moisture_val = gm.value();
40 41
 			String result;
@@ -50,5 +51,6 @@ public class GroveMoistureSample{
50 51
 		
51 52
 			Thread.sleep(1000);
52 53
 		}
54
+        //! [Interesting]
53 55
 	}
54 56
 }

+ 4
- 2
examples/java/GroveRelaySample.java Ver arquivo

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

+ 4
- 2
examples/java/GroveRotarySample.java Ver arquivo

@@ -34,7 +34,8 @@ public class GroveRotarySample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		upm_grove.GroveRotary knob = new upm_grove.GroveRotary(0);
37
+		//! [Interesting]
38
+        upm_grove.GroveRotary knob = new upm_grove.GroveRotary(0);
38 39
 	
39 40
 		while (true) {
40 41
 			float abs_value = knob.abs_value();	// Absolute raw value
@@ -49,6 +50,7 @@ public class GroveRotarySample{
49 50
 			
50 51
 			Thread.sleep(3000);
51 52
 		}
53
+        //! [Interesting]
52 54
 	}
53 55
 
54
-}
56
+}

+ 3
- 1
examples/java/GroveSlideSample.java Ver arquivo

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

+ 4
- 2
examples/java/GroveSpeakerSample.java Ver arquivo

@@ -34,7 +34,8 @@ public class GroveSpeakerSample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		// Instantiate a Grove Speaker on digital pin D2
37
+		//! [Interesting]
38
+        // Instantiate a Grove Speaker on digital pin D2
38 39
 		upm_grovespeaker.GroveSpeaker speaker = new upm_grovespeaker.GroveSpeaker(2);
39 40
 		
40 41
 		// Play all 7 of the lowest notes
@@ -42,6 +43,7 @@ public class GroveSpeakerSample{
42 43
 		
43 44
 		// Play a medium C-sharp
44 45
 		speaker.playSound('c', true, "med");
45
-	}
46
+	    //! [Interesting]
47
+    }
46 48
 
47 49
 }

+ 3
- 1
examples/java/GroveTempSample.java Ver arquivo

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

+ 4
- 2
examples/java/GroveWaterSample.java Ver arquivo

@@ -34,7 +34,8 @@ public class GroveWaterSample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		// Instantiate a Grove Water sensor on digital pin D2
37
+		//! [Interesting]
38
+        // Instantiate a Grove Water sensor on digital pin D2
38 39
 		upm_grovewater.GroveWater water = new upm_grovewater.GroveWater(2);
39 40
 		
40 41
 		while (true) {
@@ -48,7 +49,8 @@ public class GroveWaterSample{
48 49
 			
49 50
 			Thread.sleep(1000);
50 51
 		}
52
+        //! [Interesting]
51 53
 	}
52 54
 	
53 55
 
54
-}
56
+}

+ 4
- 3
examples/java/Jhd1313m1Sample.java Ver arquivo

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

+ 5
- 3
examples/java/MQ303ASample.java Ver arquivo

@@ -34,7 +34,8 @@ public class MQ303ASample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		// Instantiate an mq303a sensor on analog pin A0
37
+		//! [Interesting]
38
+        // Instantiate an mq303a sensor on analog pin A0
38 39
 		 
39 40
 		// This device uses a heater powered from an analog I/O pin.·
40 41
 		// If using A0 as the data pin, then you need to use A1, as the heater
@@ -57,6 +58,7 @@ public class MQ303ASample{
57 58
 		
58 59
 		mq303a.heaterEnable(false);
59 60
 		System.out.println("Exiting");
60
-	}
61
+	    //! [Interesting]
62
+    }
61 63
 
62
-}
64
+}

+ 4
- 2
examples/java/MY9221Sample.java Ver arquivo

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

+ 4
- 2
examples/java/NUNCHUCKSample.java Ver arquivo

@@ -34,7 +34,8 @@ public class NUNCHUCKSample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		// Instantiate a nunchuck controller bus 0
37
+		//! [Interesting]
38
+        // Instantiate a nunchuck controller bus 0
38 39
 		upm_nunchuck.NUNCHUCK nunchuck = new upm_nunchuck.NUNCHUCK(0);
39 40
 		
40 41
 		// always do this first
@@ -62,6 +63,7 @@ public class NUNCHUCKSample{
62 63
 						
63 64
 			Thread.sleep(1000);
64 65
 		}
66
+        //! [Interesting]
65 67
 	}
66 68
 
67
-}
69
+}

+ 4
- 2
examples/java/OTP538USample.java Ver arquivo

@@ -35,7 +35,8 @@ public class OTP538USample{
35 35
 	}
36 36
 	
37 37
 	public static void main(String[] args) throws InterruptedException {
38
-		// Instantiate a OTP538U on analog pins A0 and A1
38
+		//! [Interesting]
39
+        // Instantiate a OTP538U on analog pins A0 and A1
39 40
 		// A0 is used for the Ambient Temperature and A1 is used for the Object temperature.
40 41
 		upm_otp538u.OTP538U temps = new upm_otp538u.OTP538U(0, 1, OTP538U_AREF);
41 42
 
@@ -45,5 +46,6 @@ public class OTP538USample{
45 46
 		
46 47
 			Thread.sleep(1000);
47 48
 		}
49
+        //! [Interesting]
48 50
 	}
49
-}
51
+}

+ 4
- 2
examples/java/RFR359FSample.java Ver arquivo

@@ -34,7 +34,8 @@ public class RFR359FSample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		// Instantiate an RFR359F digital pin D2
37
+		//! [Interesting]
38
+        // Instantiate an RFR359F digital pin D2
38 39
 		upm_rfr359f.RFR359F dInterruptor = new upm_rfr359f.RFR359F(2);
39 40
 		
40 41
 		while(true){
@@ -47,6 +48,7 @@ public class RFR359FSample{
47 48
 			
48 49
 			Thread.sleep(100);
49 50
 		}
51
+        //! [Interesting]
50 52
 	}
51 53
 	
52
-}
54
+}

+ 4
- 2
examples/java/RotaryEncoderSample.java Ver arquivo

@@ -34,7 +34,8 @@ public class RotaryEncoderSample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		// Create the button object using UART
37
+		//! [Interesting]
38
+        // Create the button object using UART
38 39
 		upm_rotaryencoder.RotaryEncoder rotaryencoder = new upm_rotaryencoder.RotaryEncoder(2, 3);
39 40
 	
40 41
 		while (true) {
@@ -42,6 +43,7 @@ public class RotaryEncoderSample{
42 43
 			
43 44
 			Thread.sleep(1000);
44 45
 		}
46
+        //! [Interesting]
45 47
 	}
46 48
 
47
-}
49
+}

+ 4
- 2
examples/java/TP401Sample.java Ver arquivo

@@ -41,7 +41,8 @@ public class TP401Sample{
41 41
 	}
42 42
 	
43 43
 	public static void main(String[] args) throws InterruptedException {
44
-		// Instantiate new grove air quality sensor on analog pin A0
44
+		//! [Interesting]
45
+        // Instantiate new grove air quality sensor on analog pin A0
45 46
 		upm_gas.TP401 airSensor = new upm_gas.TP401(0);
46 47
 		
47 48
 		System.out.println(airSensor.name());
@@ -63,7 +64,8 @@ public class TP401Sample{
63 64
 			
64 65
 			Thread.sleep(100);
65 66
 		}
67
+        //! [Interesting]
66 68
 	}
67 69
 	
68 70
 
69
-}
71
+}

+ 4
- 2
examples/java/TTP223Sample.java Ver arquivo

@@ -34,7 +34,8 @@ public class TTP223Sample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		upm_ttp223.TTP223 touch = new upm_ttp223.TTP223(7);
37
+		//! [Interesting]
38
+        upm_ttp223.TTP223 touch = new upm_ttp223.TTP223(7);
38 39
 	
39 40
 		while (true) {
40 41
 			if(touch.isPressed())
@@ -44,6 +45,7 @@ public class TTP223Sample{
44 45
 			
45 46
 			Thread.sleep(1000);
46 47
 		}
48
+        //! [Interesting]
47 49
 	}
48 50
 
49
-}
51
+}

+ 4
- 2
examples/java/YG1006Sample.java Ver arquivo

@@ -34,7 +34,8 @@ public class YG1006Sample{
34 34
 	}
35 35
 	
36 36
 	public static void main(String[] args) throws InterruptedException {
37
-		// Instantiate a yg1006 flame sensor on digital pin D2
37
+		//! [Interesting]
38
+        // Instantiate a yg1006 flame sensor on digital pin D2
38 39
 		upm_yg1006.YG1006 flame = new upm_yg1006.YG1006(2);
39 40
 		
40 41
 		while (true) {
@@ -48,6 +49,7 @@ public class YG1006Sample{
48 49
 			
49 50
 			Thread.sleep(1000);
50 51
 		}
52
+        //! [Interesting]
51 53
 	}
52 54
 
53
-}
55
+}