Raspberry Pi Gaming 4 Kids (Devoxx4Kids)

57 %
43 %
Information about Raspberry Pi Gaming 4 Kids (Devoxx4Kids)

Published on February 19, 2014

Author: steveonjava

Source: slideshare.net


Presentation for teaching kids programming using the Raspberry Pi and Java.

Raspberry Pi Gaming 4 Kids Stephen Chin (@steveonjava)

What Runs Java?

What Runs Java?

Java and 3G in a Tiny Package > Cinterion EHS5

Really Tiny… 18.8mm 27.6mm


Have Java With Your Dessert Raspberry Pi =

Pis are Affordable $35

Pis are Affordable A Cake Bicycle (but just 1 wheel) $35 1 Box of Diapers

Chalkboard Electronics Touchscreen  10" or 7" Form Factor  Connects via HDMI/USB  Tested with JavaFX 8  10% Exclusive Discount: G1F0U796Z083

How to Setup Your Pi > Step 1: Install Linux > Step 2: Download/Copy Java 8 for ARM EA > Step 3: Deploy and Run JVM Language Apps http://steveonjava.com/ javafx-on-raspberry-pi-3-easy-steps/

What Comes in Your Lab Kit Touch Screen SD Card Keyboard Yellow Box: 1. 2. 3. 4.      Power Adapter LVDS Cable/Board Raspberry Pi Model B Mini-USB Cable (power) Micro-USB Cable (keyboard) Please Save All the Packaging for Later

Electronic Safety! > Unplug from wall before wiring > Get rid of static by touching a metal surface > Don't touch exposed wires/metal > Never remove/insert SD Card while power is on 13

Hooking Up the Pi (Part A) Important: Connect everything before plugging into the wall Insert the SD Card in to the Pi 1.  Will appear upside down when looking at the top of your Pi Insert the HDMI board into the Pi's HDMI jack Connect the Pi power to the HDMI board 2. 3.  Use the Micro USB Cable (short one) 14

Hooking Up the Pi (Part B) Slide the LCD cable into the back of the display 4.   Side with gold connectors goes up Be careful, the connector is fragile! Connect the USB end to one of the Pi's USB host ports 5.  This provides touch input Hook up the USB keyboard 6. 1. Use the Mini USB cable (long one) Verify connections and plug into power now 15

Is it Working? > Should get a bunch of flashing LEDs to indicate booting  > The LCD screen should light up  > Boot takes approx 30 seconds Might be dim if the light sensor is obstructed And you will should see a Linux boot screen with lots of text Hacking Time!

Logging In At the login prompt type your username: > pi And enter the password: > raspberry

Running Your First Application Change directory to the project folder > cd MaryHadALittleLambda Run the build script > ant


Hacking the Code Run the nano text editor: > nano src/sample/MapObject.java Save your changes: > Control-O Enter Exit Nano: > Control-X Compile/Run: > ant

Mary Had a Little Lambda Mary had a little lambda Whose fleece was white as snow And everywhere that Mary went Lambda was sure to go! https://github.com/steveonjava/MaryHadALittleLambda

Generating Streams From a collection: > anyCollection.stream(); Known set of objects: > Stream.of("bananas", "oranges", "apples"); Numeric range: > IntStream.range(0, 50) Iteratively: > Stream.iterate(Color.RED, > c -> Color.hsb(c.getHue() + .1, c.getSaturation(), > c.getBrightness())); 22

Let's Create Some Barn Animals! SpriteView tail = s.getAnimals().isEmpty() ? s : s.getAnimals().get(s.getAnimals().size() - 1); Stream.iterate(tail, SpriteView.Lamb::new) .skip(1).limit(7) .forEach(s.getAnimals()::add); 23


Filtering Streams Predicate Expression > public interface Predicate<T> { > public boolean test(T t); > } Filter out minors > adults = attendees.filter(a -> a.getAge() >= 1.8) 25

Rainbow-colored Lambs! s.getAnimals().stream() .filter(a -> a.getNumber() % 4 == 2) .forEach(a -> a.setColor(Color.YELLOW)); s.getAnimals().stream() .filter(a -> a.getNumber() % 4 == 3) .forEach(a -> a.setColor(Color.CYAN)); s.getAnimals().stream() .filter(a -> a.getNumber() % 4 == 0) .forEach(a -> a.setColor(Color.GREEN)); 26


Filtering Collections Collection.removeIf > Removes all elements that match the predicate List.replaceAll > In-place filtering and replacement using an unary operator ObservableCollection.filtered > Returns a list filtered by a predicate this is also Observable 28

Picky Eaters… Predicate<SpriteView> pure = a -> a.getColor() == null; mealsServed.set(mealsServed.get() + s.getAnimals().filtered(pure).size() ); s.getAnimals().removeIf(pure); 29


Mapping Streams Applies a Map Function to each element: > Function<? super T, ? extends R> Result: List is the same size, but may be a different type. 31

Single Map s.getAnimals().setAll(s.getAnimals() .stream() .map(sv -> new Eggs(sv.getFollowing()) .collect(Collectors.toList()) ); 32

Or a Double Map! s.getAnimals().setAll(s.getAnimals() .stream() .map(SpriteView::getFollowing) .map(Eggs::new) .collect(Collectors.toList()) ); 33


Flat Map Applies a One-to-Many Map Function to each element: > Function<? super T, ? extends Stream<? extends R>> And then flattens the result into a single stream. Result: The list may get longer and the type may be different. 35

Hatching Eggs s.getAnimals().setAll(s.getAnimals() .stream() .flatMap(SpriteView.Eggs::hatch) .collect(Collectors.toList()) ); 36


Reduce Reduces a list to a single element given: > Identity: T > Accumulator: BinaryOperator<T> Result: List of the same type, but only 1 element left. 38

And the (formerly little) Fox ate them all! Double mealSize = shepherd.getAnimals() .stream() .map(SpriteView::getScaleX) .reduce(0.0, Double::sum); setScaleX(getScaleX() + mealSize * .2); setScaleY(getScaleY() + mealSize * .2); shepherd.getAnimals().clear(); 39


Mary Had a Little Lambda Project > > Open-source project to demonstrate lambda features Visual representation of streams, filters, and maps https://github.com/steveonjava/MaryHadALittleLambda 41

NightHacking Tour Stephen Chin (@steveonjava) http://steveonjava.com/ Real Geeks Live Hacking nighthacking.com

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.

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

RaspberryPi Gaming 4 Kids – Devoxx4Kids USA

The Raspberry Pi is a credit-card sized computer designed specifically for teaching programming in schools. We will be using it in this session to explore ...
Read more

Raspberry Pi Gaming 4 Kids (Devoxx4Kids) - Technology

1. Raspberry Pi Gaming 4 Kids Stephen Chin (@steveonjava) 2. What Runs Java? 3. What Runs Java? 4. Java and 3G in a Tiny Package >Cinterion EHS5
Read more

Devoxx4Kids USA – Game programming, robotics, engineering ...

RaspberryPi Gaming 4 Kids; ... Welcome to Devoxx4Kids USA! ... and Portland (coming soon). We offer a variety of workshops from Raspberry Pi, Arduino ...
Read more

Oracle Brings Code to Kids | Oracle

Why and How Your Kids Should Learn to Code ... HTML5, and Raspberry Pi gaming. ... A collaboration of the global Devoxx4Kids initiative and Oracle ...
Read more

OSCON Kids Day (Sold Out): O'Reilly Open Source Convention ...

This year at OSCON we’re partnering with Devoxx4Kids to ... Raspberry Pi Gaming 4 Kids: ... 4 Kids Instructor: Stephen Chin The Raspberry Pi is ...
Read more

Raspberry pi gaming consolele - Education - documents

Share Raspberry pi gaming consolele. ... Raspberry Pi Gaming 4 Kids (Devoxx4Kids) Raspberry Pi Gaming 4 Kids ...
Read more

Java for the Very Young | The Java Source - blogs.oracle.com

Raspberry Pi Gaming 4 Kids. ... If you want to run a programming event for kids, visit Devoxx4kids.org. Free training is available for your own event.
Read more

Steve On Java » Java Lego Workshop 4 Kids

Java Lego Workshop 4 Kids ... This past weekend I did a Lego workshop for the local Devoxx4Kids bay area chapter. ... Raspberry Pi Gaming 4 Kids ...
Read more