Lego mindstorms with Java (leJOS)

download Lego mindstorms with Java (leJOS)

If you can't read please download the document

Transcript of Lego mindstorms with Java (leJOS)

How to Use the PowerPoint Template

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |

1

IoT

Yoshio TeradaJava Evangelist

Fusion Middleware OrgJul 24, 2014

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |This is a Title Slide with Java FY15 Theme slide ideal for including the Java Theme with a brief title, subtitle and presenter information.

To customize this slide with your own picture:

Right-click the slide area and choose Format Background from the pop-up menu. From the Fill menu, click Picture and texture fill. Under Insert from: click File. Locate your new picture and click Insert.

To copy the Customized Background from Another Presentation on PCClick New Slide from the Home tab's Slides group and select Reuse Slides.Click Browse in the Reuse Slides panel and select Browse Files. Double-click the PowerPoint presentation that contains the background you wish to copy.Check Keep Source Formatting and click the slide that contains the background you want.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Right-click any selected slide, point to Layout, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.

To copy the Customized Background from Another Presentation on MacClick New Slide from the Home tab's Slides group and select Insert Slides from Other PresentationNavigate to the PowerPoint presentation file that contains the background you wish to copy. Double-click or press Insert. This prompts the Slide Finder dialogue box.Make sure Keep design of original slides is unchecked and click the slide(s) that contains the background you want. Hold Shift key to select multiple slides.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Click Layout from the Home tab's Slides group, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.2

Oracle

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |3

Program AgendaLEGO Mindstorms 12345Oracle Confidential Internal/Restricted/Highly Restricted4

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |

4

Oracle Confidential Internal/Restricted/Highly Restricted5Internet Of Things

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |This is a Section Header with Picture slide ideal for including a picture with a brief title and optional subtitle. This slide can also be used as a Q and A slide.

To customize this slide with your own picture:

Right-click the slide area and choose Format Background from the pop-up menu. From the Fill menu, click Picture and texture fill. Under Insert from: click File. Locate your new picture and click Insert.

To copy the Customized Background from Another Presentation on PCClick New Slide from the Home tab's Slides group and select Reuse Slides.Click Browse in the Reuse Slides panel and select Browse Files. Double-click the PowerPoint presentation that contains the background you wish to copy.Check Keep Source Formatting and click the slide that contains the background you want.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Right-click any selected slide, point to Layout, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.

To copy the Customized Background from Another Presentation on MacClick New Slide from the Home tab's Slides group and select Insert Slides from Other PresentationNavigate to the PowerPoint presentation file that contains the background you wish to copy. Double-click or press Insert. This prompts the Slide Finder dialogue box.Make sure Keep design of original slides is unchecked and click the slide(s) that contains the background you want. Hold Shift key to select multiple slides.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Click Layout from the Home tab's Slides group, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.5

2020 500 Oracle Confidential Internal/Restricted/Highly Restricted6500

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |This is a sample Metric with Picture slide ideal for including a picture with a large metric and statement, to emphasize a percentage or figure for impact.

To customize this slide with your own picture:

Right-click the slide area and choose Format Background from the pop-up menu. From the Fill menu, click Picture and texture fill. Under Insert from: click File. Locate your new picture and click Insert.

To copy the Customized Background from Another Presentation on PCClick New Slide from the Home tab's Slides group and select Reuse Slides.Click Browse in the Reuse Slides panel and select Browse Files. Double-click the PowerPoint presentation that contains the background you wish to copy.Check Keep Source Formatting and click the slide that contains the background you want.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Right-click any selected slide, point to Layout, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.

To copy the Customized Background from Another Presentation on MacClick New Slide from the Home tab's Slides group and select Insert Slides from Other PresentationNavigate to the PowerPoint presentation file that contains the background you wish to copy. Double-click or press Insert. This prompts the Slide Finder dialogue box.Make sure Keep design of original slides is unchecked and click the slide(s) that contains the background you want. Hold Shift key to select multiple slides.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Click Layout from the Home tab's Slides group, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.6

!!

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |So here we are. Javaone 2013, the world is changing around us. More apps, more devices, more data, more infrastructure. Therein lies the opportunity. Java and Java developers are uniquly skilled and positioned to make the future java happen. Javas impact will span from tiny devices to cloud based applications. But to make that vision a reality we have work to do. We would like to use our time today to help you better understand the opportunity, what our focus is moving forward and what investments we are making to humanity..

7

Oracle Confidential Internal/Restricted/Highly Restricted8

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |This is a Section Header with Picture slide ideal for including a picture with a brief title and optional subtitle. This slide can also be used as a Q and A slide.

To customize this slide with your own picture:

Right-click the slide area and choose Format Background from the pop-up menu. From the Fill menu, click Picture and texture fill. Under Insert from: click File. Locate your new picture and click Insert.

To copy the Customized Background from Another Presentation on PCClick New Slide from the Home tab's Slides group and select Reuse Slides.Click Browse in the Reuse Slides panel and select Browse Files. Double-click the PowerPoint presentation that contains the background you wish to copy.Check Keep Source Formatting and click the slide that contains the background you want.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Right-click any selected slide, point to Layout, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.

To copy the Customized Background from Another Presentation on MacClick New Slide from the Home tab's Slides group and select Insert Slides from Other PresentationNavigate to the PowerPoint presentation file that contains the background you wish to copy. Double-click or press Insert. This prompts the Slide Finder dialogue box.Make sure Keep design of original slides is unchecked and click the slide(s) that contains the background you want. Hold Shift key to select multiple slides.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Click Layout from the Home tab's Slides group, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.8

LEGO MindstormsOracle Confidential Internal/Restricted/Highly Restricted9

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |This is a Quote with Logo slide ideal for including a partner or product logo with a brief quotation and attribution.

To Replace the LOGO on this sample slide:

Right-click the sample LOGO and choose Change Picture. Navigate to the location where the new logo is stored, select desired logo file and click on the Open button to replace the sample logo.

9

Oracle Confidential Internal/Restricted/Highly Restricted10

MIT LEGO LEGO LEGO Mindstorms

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted11

LEGO Mindstorms LEGO Mindstorms

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted12

EV 3 4 : 1, 2, 3, 4A, B, C, D

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |

Oracle Confidential Internal/Restricted/Highly Restricted13

USB (Wifi) , SD

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted14 EV 3

LEGO

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |This is a sample Smartphone and Tablet: Horizontal slide ideal for including sample mobile device screen pictures.

To Replace the Pictures on this Sample Slide (this applies to all slides in this template that contain replaceable pictures)

Select the sample picture and press Delete. Click the icon inside the shape to open the Insert Picture dialog box. Navigate to the location where the picture is stored, select desired picture and click on the Insert button to fit the image proportionally within the shape.

Note: Do not right-click the image to change the picture inside the picture placeholder. This will change the frame size of the picture placeholder. Instead, follow the steps outlined above. 14

Oracle Confidential Internal/Restricted/Highly Restricted15

Micro SD LEGO Java APILego Java Operating System (leJOS) EV 3 EV 3 ROMleJOS leJOS leJOS

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |

http://tinyurl.com/javaseembedded8http://tinyurl.com/java-legoJava SE Embedded 8

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |http://tinyurl.com/lejos-setupleJOS

(Mac,Win,Linux)Java SE 8NetBeans 8.0MavenLEGO MindstormsMicro SD Card (bootable FAT32 format)leJOS (0.8.1-beta)Java SE Embedded 8Wifi

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |leJOS NetBeans 8(JDK 7,8)LEGO Mindstorms

Wifi

scp, ssh

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |NetBeans 8(JDK 7,8)LEGO Mindstorms

Wifi

scp, ssh

Copyright 2014, Oracle and/or its affiliates. All rights reserved. | &

Copyright 2014, Oracle and/or its affiliates. All rights reserved. | jar MANIFEST.MF Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Built-By: Yoshio Terada Class-Path: /home/root/lejos/lib/ev3classes.jar /home/root/lejos/libjna/usr/share/java/jna.jar Created-By: Apache Maven 3.0.5 Build-Jdk: 1.8.0 Main-Class: com.yoshio3.legomind.EV3AppMain Maven maven-jar-plugin pom.xml Class-Path:

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted22LCD Hello World public class EV3AppMain { public static void main(String... argv) {EV3AppMain main = new EV3AppMain();

LCD.drawString(Hello World, 0, 0);

EV3 ev3 = (EV3) BrickFinder.getLocal();Keys keys = ev3.getKeys();keys.waitForAnyPress();}}

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |jar NetBeans 8(JDK 7,8)LEGO Mindstorms

Wifi

scp

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted24 jar scp LEGO Mindstorms > scp LEGOMind-1.0-SNAPSHOT.jar \ [email protected]:/home/lejos/programs Maven wagon-maven-plugin scp LEGO Mindstorms http://maven.apache.org/wagon/

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |leJOS NetBeans 8(JDK 7,8)LEGO Mindstorms

Wifi

scp

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted26LEGO Mindstorms

1.DIR

2.

3.

4.

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted27

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |This is a Section Header with Picture slide ideal for including a picture with a brief title and optional subtitle. This slide can also be used as a Q and A slide.

To customize this slide with your own picture:

Right-click the slide area and choose Format Background from the pop-up menu. From the Fill menu, click Picture and texture fill. Under Insert from: click File. Locate your new picture and click Insert.

To copy the Customized Background from Another Presentation on PCClick New Slide from the Home tab's Slides group and select Reuse Slides.Click Browse in the Reuse Slides panel and select Browse Files. Double-click the PowerPoint presentation that contains the background you wish to copy.Check Keep Source Formatting and click the slide that contains the background you want.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Right-click any selected slide, point to Layout, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.

To copy the Customized Background from Another Presentation on MacClick New Slide from the Home tab's Slides group and select Insert Slides from Other PresentationNavigate to the PowerPoint presentation file that contains the background you wish to copy. Double-click or press Insert. This prompts the Slide Finder dialogue box.Make sure Keep design of original slides is unchecked and click the slide(s) that contains the background you want. Hold Shift key to select multiple slides.Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Click Layout from the Home tab's Slides group, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates.27

Oracle Confidential Internal/Restricted/Highly Restricted28leJOS EV3 API

http://www.lejos.org/ev3/docs/ API:EV3UltrasonicSensor:EV3ColorSensor:EV3GyroSensor API: EV3LargeRegulatedMotor: EV3MediumRegulatedMotor

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted29

Button.LEDPattern(i);

LCD.drawString("LED PATTERN : " + i, 0, 0); LED 1:

2:

3:

4:

5:

6:

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted30import lejos.hardware.motor.Motor;import lejos.robotics.RegulatedMotor;

private static final EV3LargeRegulatedMotorleftMotor = Motor.B;

void operateMotorSample(){ leftMotor.forward(); // stop() flt() leftMotor.backward(); // stop() flt() leftMotor.stop(); // leftMotor.rotate(360); // leftMotor.setSpeed(50); // }

Copyright 2014, Oracle and/or its affiliates. All rights reserved. |Oracle Confidential Internal/Restricted/Highly Restricted31 private static final EV3UltrasonicSensor ursensor = new EV3UltrasonicSensor(SensorPort.S4);

ExecutorService execSvc = // execSvc.submit((Runnable) () -> { SensorMode sonic = ursensor.getMode(0); //0: Distance Mode(cm) 1:Listen Mode float value[] = new float[sonic.sampleSize()]; while (true) { //sonic.sampleSize()1 value[0] sonic.fetchSample(value, 0); int centimeter = (int) (value[0] * 100); //1m1.000 (MIN:3cm MAX:250cm) if (Integer.MAX_VALUE != centimeter && centimeter