devoxx4kids lego workshop
TRANSCRIPT
![Page 1: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/1.jpg)
Devoxx4KidsLego Kids Workshop
Stephen Chin
Java Community Manager
JavaOne Content Co-Chair
@steveonjava
![Page 2: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/2.jpg)
LeJOSHow it works on the EV3
![Page 3: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/3.jpg)
The Heart of the EV3
> TI Sitara AM1808
ARM9, 300Mhz
> 64MB RAM / 16MB Flash
> Analog to Digital Converter
> 4 Motor Ports
> 4 Sensor Ports
> Bluetooth / USB
> MicroSD
![Page 4: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/4.jpg)
EV3 Motors
![Page 5: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/5.jpg)
EV3 Sensors
![Page 6: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/6.jpg)
Color and Light Sensor
![Page 7: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/7.jpg)
High frequency
sound waves
Measuring mode Vs Presence Mode
Ultrasonic Sensor
![Page 8: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/8.jpg)
Infrared Sensor
![Page 9: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/9.jpg)
Remote Control
![Page 10: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/10.jpg)
Getting Started with LeJOS
> Micro SD Card (> 2GB)
> Compatible WIFI adapter
NetGear WNA1100
EDIMAX EW-7811Un
> Linux (or a Linux VM)
> Details here:
Creating Your SD Card
http://sourceforge.net/p/lejos/wiki/Home/
![Page 11: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/11.jpg)
Lego Duke Segway
![Page 12: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/12.jpg)
Windows USB ConnectionStep 1: The wrong driver gets installed, so we need to fix this in the Device Manager
13Credit 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
![Page 13: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/13.jpg)
Windows USB ConnectionStep 2: In Device Manager, find your EV3’s RNDIS device. It is under Network Adapters > USB Ethernet/RNDIS Gadget.
14Credit 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
![Page 14: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/14.jpg)
Windows USB ConnectionStep 3: Double-click it and select the Drivers tab. Click Update driver… to change the driver.
15Credit 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
![Page 15: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/15.jpg)
Windows USB ConnectionStep 4: Select Browse my computer for driver software.
16Credit 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
![Page 16: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/16.jpg)
Windows USB ConnectionStep 5: Click Let me pick from a list of device drivers on my computer.
17Credit 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
![Page 17: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/17.jpg)
Windows USB ConnectionStep 6: Uncheck the box that says Show compatible hardware. In the Manufacturer list, pick Microsoft Corporation (in Windows 8, pick Microsoft). In the Network Adapter list, pick Remote NDIS Compatible Device. Then click Next.
18Credit 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
![Page 18: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/18.jpg)
Windows USB ConnectionStep 7: Windows thinks we don’t know what we are doing, but really we do, so click Yes.
19Credit 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
![Page 19: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/19.jpg)
Windows USB ConnectionStep 8: When it is done installing, click Close.
20Credit 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
![Page 20: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/20.jpg)
Eclipse Setup
> Open Eclipse
> Go to "Preferences"
> Click on leJOS EV3
> Change the brick name to the IP address of your brick
(default is 10.0.1.1)
21
![Page 21: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/21.jpg)
Creating a New LeJOS Project
> Go to "File" > "New" > "Project…"
> Choose a LeJOS EV3 Project
22
![Page 22: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/22.jpg)
Create a Class File
> Create a new class ("File" > "New" > "Class")
> Give it a package (e.g. sample)
> Give it a name (e.g. LCDTest)
23
![Page 23: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/23.jpg)
Simple LeJOS Application
public class EV3FirstProgram {
public static void main(String[] args) {
LCD.clear();
LCD.drawString("First EV3 Program", 0, 5);
Button.waitForAnyPress();
LCD.clear();
LCD.refresh();
}
}
![Page 24: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/24.jpg)
Stephen Chintweet: @steveonjava
blog: http://steveonjava.com
nighthacking.com
Real Geeks
Live Hacking
NightHacking Tour
Hacking Time!
![Page 25: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/25.jpg)
Parts you will need Step 1
Assemble Brace
![Page 26: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/26.jpg)
Step 2 Completed Brace
Assemble Brace
![Page 27: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/27.jpg)
Parts you will need Step 1
Build Base
![Page 28: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/28.jpg)
Step 2 Completed Base
Build Base
![Page 29: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/29.jpg)
Motor parts Snap them on partially
Assemble Motor
![Page 30: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/30.jpg)
Take motor and base And connect them like this
Assemble Motor
![Page 31: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/31.jpg)
Foot parts Step 1
Add a Foot
![Page 32: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/32.jpg)
Step 2 Add the Foot to the Base
Add a Foot
![Page 33: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/33.jpg)
Assembled Foot and Base
Add a Foot
![Page 34: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/34.jpg)
Lock parts Partially insert the red attachers
Add a Lock
![Page 35: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/35.jpg)
Attach the lock Push down the red attachers to secure
Add a Lock
![Page 36: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/36.jpg)
Tower parts Step 1 – push the rod all the way through
Construct the Tower
![Page 37: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/37.jpg)
Step 2 Attach the Tower to the Base
Construct the Tower
![Page 38: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/38.jpg)
Completed Tower
Construct the Tower
![Page 39: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/39.jpg)
Fan Motor parts Step 1
Build the Fan Motor
![Page 40: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/40.jpg)
Completed Fan Motor
Build the Fan Motor
![Page 41: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/41.jpg)
Light Sensor parts Step 1
Construct the Light Sensor
![Page 42: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/42.jpg)
Completed Light Sensor
Construct the Light Sensor
![Page 43: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/43.jpg)
Fan Blade parts Step 1
Assemble the Fan Blades
![Page 44: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/44.jpg)
Fan Blade, Light Sensor, and Fan Motor Completed Fan
Assemble the Fan
![Page 45: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/45.jpg)
Assembled Wind Turbine
46
![Page 46: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/46.jpg)
Wind Turbine Wiring
> Port A – Medium Moto
Power Fan
> Port B – Large Motor
Rotate Wind Turbine
> Port 1 – Light Sensor
Track Ambient Light
47
![Page 47: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/47.jpg)
Gear Box parts Step 1
EC: Gear Box Construction
![Page 48: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/48.jpg)
Completed Fan with Gear Box
EC: Gear Box Construction
![Page 49: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/49.jpg)
Making the Wind turbine turn
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);
}
}
![Page 50: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/50.jpg)
Making the Tower spin
public class WindTurbine {
public static void main(String[] args) {
EV3LargeRegulatedMotor base =
new EV3LargeRegulatedMotor(MotorPort.B);
base.setSpeed(80);
base.rotateTo(-90);
base.rotateTo(90);
}
}
![Page 51: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/51.jpg)
Checking the Ambient Light
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);
}
}
![Page 52: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/52.jpg)
Putting it all together…
> Can you write a program that will:
1. Rotate the fan in a circle
2. Check the ambient light while rotating
3. Move back to the brightest angle
4. Spin the fan
http://commons.wikimedia.org/wiki/Wind_generator#mediaviewer/File:Eolienne_et_centrale_thermique_Nuon_Sloterdijk.jpg
![Page 53: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/53.jpg)
Stephen Chintweet: @steveonjava
blog: http://steveonjava.com
nighthacking.com
Real Geeks
Live Hacking
NightHacking Tour
![Page 54: Devoxx4Kids Lego Workshop](https://reader034.vdocuments.mx/reader034/viewer/2022052116/55a928fd1a28abc3768b4799/html5/thumbnails/54.jpg)
Safe Harbor Statement
The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.