Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Raspberry Pi with Java (JJUG)

3,811 views

Published on

Presentation on Raspberry Pi with Java given as the keynote for the bi-annual Japan Java User Group (JJUG) event.

Published in: Technology
  • Sex in your area is here: ♥♥♥ http://bit.ly/2ZDZFYj ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating direct: ❤❤❤ http://bit.ly/2ZDZFYj ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Raspberry Pi with Java (JJUG)

  1. 1. Java with Raspberry Pi Stephen Chin (@steveonjava) Java Community Manager JavaOne Conference Chair
  2. 2. Java Scale Raspberry Pi Coffee
  3. 3. Fuglen Coffee 3
  4. 4. The Coffeeshop Roast Works 4
  5. 5. About Life Coffee 5
  6. 6. Bridge Coffee and Ice Cream 6
  7. 7. Bridge Coffee and Ice Cream 7
  8. 8. Latte at Bridge 8
  9. 9. Peace Coffee Roasters 9
  10. 10. Aeropress at Peace 10
  11. 11. Little Nap Coffee Stand 11
  12. 12. Espresso from Little Nap 12
  13. 13. AeroPress 13
  14. 14. Porlex Grinder 14
  15. 15. Finding a USB Scale public static UsbScaleTest findScale() throws UsbException { UsbServices services = UsbHostManager.getUsbServices(); UsbHub rootHub = services.getRootUsbHub(); // Dymo M10 Scale: UsbDevice device = findDevice(rootHub, (short) 0x0922, (short) 0x8003); // Dymo M25 Scale: if (device == null) { device = findDevice(rootHub, (short) 0x0922, (short) 0x8004); } return new UsbScaleTest(device); } 15
  16. 16. Printing out Weight public void dataEventOccurred(UsbPipeDataEvent upde) { boolean empty = data[1] == 2; boolean overweight = data[1] == 6; boolean negative = data[1] == 5; boolean grams = data[2] == 2; int scalingFactor = data[3]; int weight = (data[4] & 0xFF) + (data[5] << 8); System.out.println(String.format("Weight = %,.1f%s", scaleWeight(weight, scalingFactor), grams ? "g" : "oz")); } 16
  17. 17. 17 Driving Test https://www.flickr.com/photos/davidyuweb/1352312273
  18. 18. 18
  19. 19. 19
  20. 20. 20
  21. 21. 21
  22. 22. 22
  23. 23. 23
  24. 24. Up-Up-Down-Down-Left-Right- Left-Right B, A, Start 24
  25. 25. Meet Mr. Grabby 25 https://www.flickr.com/photos/pasukaru76/8278458818/ https://www.flickr.com/photos/fallentomato/5656700432/ + =
  26. 26. Meet Mr. Grabby 26
  27. 27. Mr. Grabby's Back 27 Controller Grabber
  28. 28. Controller • Raspberry Pi • Cooking Hacks Shield • MakeBlocks ME Base Shield 28
  29. 29. Mr. Grabby's Belly 29 Line Follower Batteries DC Motors
  30. 30. How Line Followers Work 30 • Infrared LED – Bounced light off the ground • Infrared Luminosity Sensor – Detects reflected light
  31. 31. 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(); 31
  32. 32. 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); } 32
  33. 33. 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 33
  34. 34. Ultimaker 2 34
  35. 35. 35
  36. 36. 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 36
  37. 37. 37
  38. 38. 38
  39. 39. JJUG Exclusive Pepper Workshop 39
  40. 40. Stephen Chin tweet: @steveonjava blog: http://steveonjava.com nighthacking.com Real Geeks Live Hacking NightHacking Tour
  41. 41. 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. 41

×