10. Chalkboard Electronics Touchscreen
10" or 7" Form Factor
Connects via HDMI/USB
Tested with JavaFX 8
10% Exclusive Discount:
G1F0U796Z083
11. 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/
12. What Comes in Your Lab Kit
1. Touch Screen
2. SD Card
3. Keyboard
4. Yellow Box:
Power Adapter
LVDS Cable/Board
Raspberry Pi Model B
Mini-USB Cable (power)
Micro-USB Cable (keyboard)
Please Save All the Packaging for Later
13. 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
14. Hooking Up the Pi (Part A)
1. Insert the SD Card in to the Pi
Will appear upside down when looking at the top
of your Pi
2. Insert the HDMI board into the Pi's HDMI
jack
3. Connect the Pi power to the HDMI board
Use the Micro USB Cable (short one)
14
Important: Connect everything before plugging into the wall
15. Hooking Up the Pi (Part B)
4. Slide the LCD cable into the back of the display
Side with gold connectors goes up
Be careful, the connector is fragile!
5. Connect the USB end to one of the Pi's USB
host ports
This provides touch input
6. Hook up the USB keyboard
1. Use the Mini USB cable (long one)
15
Verify connections and plug into power now
16. Is it Working?
> Should get a bunch of flashing LEDs to indicate booting
Boot takes approx 30 seconds
> The LCD screen should light up
Might be dim if the light sensor is obstructed
> And you will should see a Linux boot screen with lots of text
Hacking Time!
17. Logging In
At the login prompt type your username:
> pi
And enter the password:
> raspberry
18. Running Your First Application
Change directory to the project folder
> cd MaryHadALittleLambda
Run the build script
> ant
20. 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
21. 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
22. 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
23. 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)
.substream(1, 8)
.forEach(s.getAnimals()::add);
23
28. 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
29. Picky Eaters…
Predicate<SpriteView> pure =
a -> a.getColor() == null;
mealsServed.set(mealsServed.get() +
s.getAnimals().filtered(pure).size()
);
s.getAnimals().removeIf(pure);
29
31. 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
35. 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
38. 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
39. 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
41. Mary Had a Little Lambda Project
> Open-source project to demonstrate lambda features
> Visual representation of streams, filters, and maps
41
https://github.com/steveonjava/MaryHadALittleLambda
43. 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.
Editor's Notes
Feel free to reuse this presentation for your local user groups. Some helpful comments are in the notes section, but feel free to embellish.For more details on JavaFX/Raspberry Pi hacking, check out this post:http://javafx.steveonjava.com/javafx-on-raspberry-pi-3-easy-steps/
Java embedded technologies are used in a wide variety of embedded devices. This list is just a small sampling of devices that are currently using Java ME and SE Embedded.
Java embedded technologies are used in a wide variety of embedded devices. This list is just a small sampling of devices that are currently using Java ME and SE Embedded.
The Raspberry Pi is a consumer-focused, low-cost board. It has a slightly slower ARM processor (ARMv6 700Mhz), but a better GPU than the BeagleBoard. Connectivity is via HDMI/Component, USBx2, Ethernet, and Audio out.
And getting JavaFX is as simple as downloading Java 7 (it has been bundled since Java 7u4). Also, it is supported across different desktop platforms (shown in the picture).