Εργαστήριο Lego για παιδιά

download Εργαστήριο Lego για παιδιά

of 54

description

LeJOSΠώς δουλεύει στο EV3

Transcript of Εργαστήριο Lego για παιδιά

  • Devoxx4Kids Lego

    Stephen Chin

    Java Community Manager

    JavaOne Content Co-Chair

    @steveonjava

  • LeJOS EV3

  • EV3

    > TI Sitara AM1808

    ARM9, 300Mhz

    > 64MB RAM / 16MB Flash

    > -

    > 4

    > 4

    > Bluetooth / USB

    > MicroSD

  • EV3

  • EV3

  • LeJOS

    > Micro SD Card (> 2GB)

    > WIFI

    NetGear WNA1100

    EDIMAX EW-7811Un

    > Linux (or a Linux VM)

    > :

    SD

    http://sourceforge.net/p/lejos/wiki/Home/

  • Lego Duke Segway

  • Windows USB 1: (driver), Device Manager

    13 Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8

  • Windows USB 2: Device Manager, EV3s RNDIS. Network Adapters > USB Ethernet/RNDIS Gadget.

    14 Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8

  • Windows USB 3: Driver. Update driver .

    15 Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8

  • Windows USB 4: Browse my computer for driver software.

    16 Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8

  • Windows USB 5: Let me pick from a list of device drivers on my computer.

    17 Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8

  • Windows USB 6: Show compatible hardware. Manufacturer, Microsoft Corporation ( Windows 8, Microsoft). Network Adapter, Remote NDIS Compatible Device. Next.

    18 Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8

  • Windows USB 7: Windows , , Yes.

    19 Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8

  • Windows USB 8: , Close.

    20 Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8

  • Eclipse

    > Eclipse

    > "Preferences

    > leJOS EV3

    > IP lego

    ( 10.0.1.1)

    21

  • LeJOS

    > "File" > "New" > "Project

    > LeJOS EV3

    22

  • > ("File" > "New" > "Class")

    > (.. sample)

    > (.. LCDTest)

    23

  • LeJOS

    public class EV3FirstProgram {

    public static void main(String[] args) {

    LCD.clear();

    LCD.drawString("First EV3 Program", 0, 5);

    Button.waitForAnyPress();

    LCD.clear();

    LCD.refresh();

    }

    }

  • Stephen Chin tweet: @steveonjava

    blog: http://steveonjava.com

    nighthacking.com

    Real Geeks

    Live Hacking

    NightHacking Tour

    Hacking!

  • 1

  • 2

  • 1

  • 2

  • 1

  • 2

  • 1

  • 2

  • 1

  • 1

  • 1

  • ,

  • 46

  • > Port A

    > Port B

    > Port 1

    47

  • 1

    EC:

  • EC:

  • public class WindTurbine {

    public static void main(String[] args) {

    EV3MediumRegulatedMotor fan =

    new EV3MediumRegulatedMotor(MotorPort.A);

    fan.setSpeed(1500);

    fan.setAcceleration(150);

    fan.backward();

    Delay.msDelay(10000);

    }

    }

  • public class WindTurbine {

    public static void main(String[] args) {

    EV3LargeRegulatedMotor base =

    new EV3LargeRegulatedMotor(MotorPort.B);

    base.setSpeed(80);

    base.rotateTo(-90);

    base.rotateTo(90);

    }

    }

  • public class WindTurbine {

    public static void main(String[] args) {

    EV3ColorSensor light =

    new EV3ColorSensor(SensorPort.S1);

    float[] sample = new float[1];

    SensorMode mode = light.getAmbientMode();

    mode.fetchSample(sample, 0);

    LCD.drawString("Light = " + sample[0], 0, 4);

    Delay.msDelay(5000);

    }

    }

  • > :

    1.

    2.

    3.

    4.

    http://commons.wikimedia.org/wiki/Wind_generator#mediaviewer/File:Eolienne_et_centrale_thermique_Nuon_Sloterdijk.jpg

  • Stephen Chin tweet: @steveonjava

    blog: http://steveonjava.com

    nighthacking.com

    Real Geeks

    Live Hacking

    NightHacking Tour

  • . . , . , , Oracle Oracle.