Upload
stephen-chin
View
891
Download
2
Tags:
Embed Size (px)
Citation preview
Internet of Things Magic Show
Stephen Chin (@steveonjava)Java Technology EvangelistJavaOne Conference Chair
Angela Caicedo (@acaicedo)Java Technology Evangelist
World Population 6.3 Billion 6.8 Billion 7.2 Billion 7.6 Billion
500 Million 12.5 Billion 25 Billion 50 Billion
Connected Devices per Person
0.08 1.84 6.583.47
2003 2010 20202015
Source: Cisco
3x 5x1x
Connected Devices
Java SE 7
Last Year
APIs Language
Java SE 7
CDC 1.1
CDC 1.1(based on SE 1.4.2)
CLDC 1.1(based on SE 1.3)
CLDC 1.1
8
More Information
iotcommunity.netoracle.com/goto/javaembedded
oracle.com/iot
Twitter Facebook Java Blog LinkedIn YouTube
@Java Embedded blogs.oracle.com/java Embedded Java Developers Network
ILoveJava YouTube Java Channel
Conductive Thread Fabric Ribbon 4-Channel
The Ingredients: Hardware
Raspberry Pi B+ Woven Conductive Fabric
Pressure-Sensitive Conductice Sheet
LEDs LilyPad Vibe Board
The Ingredients: Hardware
Polar Heart Rate ReceiverPolar T34 Heart Rate Transmitter
NTSC/PAL Video Glasses
PN532 NFC/RFID controller breakout board
GPSADC1015
MPR121Capacitive Touch Sensors
How does it work?
RFID transmitter
PN532 NFC/RFID controller breakout board
Raspberry Pi B+
JavaFX UI
Magnetic Field
Serial Communicationfinal Serial serial = SerialFactory.createInstance();
try {serial.open("/dev/ttyAMA0", 115200);serial.write(wakeUP);for (int i = 0; i < SAMConfiguration.length; i++) {
System.out.printf("%02X ", SAMConfiguration[i]);}serial.write(SAMConfiguration);...
for (;;) {try {
Thread.sleep(1000);serial.write(poll);
} catch (InterruptedException ex) {...}}
} catch (Exception e) {...} finally {serial.close();}
29
Listening for cardsserial.addListener(event -> {
try {String data = event.getData();StringBuilder buffer = new StringBuilder();byte[] array = data.getBytes("UTF-16");String outStr = "";if (array.length >= ENOUGH_DATA) {
for (int i = (array.length - POS_ID); i < array.length; i++) {outStr += String.format("%02X", array[i]);
}findCard(outStr);
}serial.write(ack);
} catch (UnsupportedEncodingException ex) {System.out.println("Error: " + ex);
}});
30
Feedback Required
1
2
3
4
Did the menu pick up my selection
Is something happening or should I click again
Simple but concrete feedback
Easy to implement, simple GPIO
Useful but not enough5
Meet Mr. Grabby
43
https://www.flickr.com/photos/pasukaru76/8278458818/https://www.flickr.com/photos/fallentomato/5656700432/
+ =
How Line Followers Work
48
• Infrared LED
– Bounced light off the ground
• Infrared Luminosity Sensor
– Detects reflected light
Getting GPIO
gpio = GpioFactory.getInstance();
lineFollowA = gpio.provisionDigitalInputPin(RaspiPin.GPIO_13, "LineFollowA");
lineFollowB = gpio.provisionDigitalInputPin(RaspiPin.GPIO_14, "LineFollowA");
startGPIO();
boolean leftSensor = lineFollowA.getState().isHigh();
boolean rightSensor = lineFollowB.getState().isHigh();
49
Line Following Algorithm
if (leftSensor && rightSensor) { //we are lost
doDrive(lineLocation);
} else if (!leftSensor && !rightSensor) { //on the line
lineLocation = Drive.forward; doDrive(Drive.forward);
} else if (!leftSensor && rightSensor) { //off the right
lineLocation = Drive.left; doDrive(Drive.forward);
} else if (leftSensor && !rightSensor) { //off the left
lineLocation = Drive.right; doDrive(Drive.forward);
}
50
Make your own Mr. Grabby
• MakeBlock Advanced Robotics Kit
• MakeBlock ME Base Shield
• Cooking Hacks Shield
• USB Battery (1A)
• Code here:
https://github.com/steveonjava/LineFollower
51
Java Constructive Geometry (JCSG / JFXScad)
• Create geometries from pure Java code
• Visualize with a JavaFX user interface
• Generate STL files for 3D printing
• Project sites:
https://github.com/miho/JCSG
https://github.com/miho/JFXScad
58
Stephen Chintweet: @steveonjavablog: http://steveonjava.com
nighthacking.com
Real Geeks
Live Hacking
NightHacking Tour
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.
63