SlideShare a Scribd company logo
1 of 38
Introduction to Java ME
for the Raspberry Pi
[JavaOne 2016 CON3189]
Kevin Hooke
Julio Palma Vazquez
Who Are We?
Copyright © 2016 Accenture All rights reserved.
Kevin Hooke
Technology Architect
Accenture Java Community Champion
@kevinhooke
Julio Palma
Technology Architect
Accenture Java Community Champion
@restalion
Related Sessions JavaOne 2016
Monday, Sep 19 Tuesday, Sep 20 Wednesday, Sep 21
Introduction to Java ME 8
[CON3189]
Java ME and Single-Board
Computers for Creating
Industrial
Middleware [CON3187]
All Your Faces Belong to Us:
Building an Open Face
Recognition Platform
[CON6217]
12:30 p.m. - 1:30 p.m 2:30 p.m. - 3:30 p.m 3:00 p.m. - 4:00 p.m
Hilton - Golden Gate 6/7/8 Hilton - Golden Gate 6/7/8 Hilton - Golden Gate 6/7/8
Kevin Hooke
Julio Palma
Jorge Hidalgo
Julio Palma
Jorge Hidalgo
Mariano Rodriguez
Copyright © 2016 Accenture All rights reserved.
Session Goals
Copyright © 2016 Accenture All rights reserved.
Java ME SDK + IDE Plugins+
+
+
By Afrank99 - Own work, CC BY-SA 2.0,
https://commons.wikimedia.org/w/index.php?curid=227264
By Inductiveload - Own work, Public Domain, https://commons.wikimedia.org/w/index.php?curid=8385509
Session Goals
Copyright © 2016 Accenture All rights reserved.
Java ME SDK + IDE Plugins+
+
+
By Afrank99 - Own work, CC BY-SA 2.0,
https://commons.wikimedia.org/w/index.php?curid=227264
By Inductiveload - Own work, Public Domain, https://commons.wikimedia.org/w/index.php?curid=8385509
Build one of these:
Getting Started: Required Setup
Dev tools:
• Java ME SDK 8.3 (for Window or Linux)
• NetBeans 8.1 (Or Eclipse)
• NetBeans Java ME SDK 8.3 plugins (Or Eclipse)
Raspberry Pi runtime:
• Raspberry Pi (although can develop with emulator in ME SDK)
• Raspbian
• Java ME Embedded 8.3 for Raspberry Pi
Copyright © 2016 Accenture All rights reserved.
NetBeans setup
• Tools / Plugins /
Settings tab, Add new
‘Update Center’
• Point to unzipped
Java ME SDK plugins
in a dir using file://
On Windows:
• Use file:///
• path to folder with no
spaces in name works
best)
Copyright © 2016 Accenture All rights reserved.
NetBeans setup (2)
• ‘Available plugins’
tab
• Select:
• Java ME SDK
Tools
• Java ME SDK
Demos
• Press Install
• Ok and restart
NetBeans when
prompted
Copyright © 2016 Accenture All rights reserved.
NetBeans setup (3)
• ME SDK Welcome
displayed on restart:
Copyright © 2016 Accenture All rights reserved.
Creating a new ME Project
• File / New Project / Java
ME Embedded
Copyright © 2016 Accenture All rights reserved.
Creating a new ME project (2)
• Defaults will use an emulated
Embedded Device
• Emulated devices and connections to
real hardware provided by Java ME
SDK Device Manager (Windows and
Linux)
Copyright © 2016 Accenture All rights reserved.
Raspberry Pi setup
• SCP/SFTP Java ME JDK zip for Raspberry Pi to your Pi
• Unzip, cd to bin
• ./fix_permissions.sh
• Run with: sudo ./usertest.sh
Copyright © 2016 Accenture All rights reserved.
Connect Device Manager to Java ME on Pi
• Press ‘+’ in Device Connection Manager
• If connected over network, give IP of the
remote Pi (might auto detect)
• Should see connection status listed as
connected (below):
Copyright © 2016 Accenture All rights reserved.
Publish project to Pi
• Change Project Properties on Project
• Select ‘Platform’
• Change ‘Device’ to newly added Raspberry Pi
Copyright © 2016 Accenture All rights reserved.
Java ME Hello World!
• Instead of a simple (typical)
System.out.println()
• Internet of Things (IoT) and
embedded devices are all about
hardware
• Let’s say ‘Hello World’ with a
flashing LED!
• First need to understand
available GPIO pins on the Pi
Copyright © 2016 Accenture All rights reserved.
Raspberry Pi GPIO pins
• Pins for Input and Output – 3.3v
• For interacting with external devices:
switches, LEDs, sensors etc
• Building blocks for building IoT type
solutions!
From: Herbfargus - Own work, CC BY-SA 4.0,
https://commons.wikimedia.org/w/index.php?curid=47497384
Copyright © 2016 Accenture All rights reserved.
Raspberry Pi GPIO pins(2)
• What pin does what? (not all are GPIO)
• Raspberry Pi docs site shows which pins are power/ground, and GPIO
• Interactive online diagrams, like https://pinout.xyz/
From: https://www.raspberrypi.org/documentation/usage/gpio-plus-and-
raspi2/README.md
Copyright © 2016 Accenture All rights reserved.
Java ME and GPIO Pins
DeviceManager.open(int)
• refers to GPIO pin by Device Id (NOT GPIO pin number)
• e.g. 1 == GPIO4
• See mappings in docs here:
http://docs.oracle.com/javame/8.3/get-started-rpi/device-i-o-preconfigured-
list.htm#MEEPG148
Copyright © 2016 Accenture All rights reserved.
Java ME and GPIO Pins
DeviceManager.open(int)
• refers to GPIO pin by Device Id (NOT GPIO pin number)
• e.g. 1 == GPIO4
• See mappings in docs here:
http://docs.oracle.com/javame/8.3/get-started-rpi/device-i-o-preconfigured-
list.htm#MEEPG148
Less confusing – open by “pin name”, e.g. “GPIO4”
DeviceManager.open(“GPIO4”, GPIOPin.class)
• Refers to pin by configured name, e.g. “GPIO4”.
• Mappings defined in same doc above
Copyright © 2016 Accenture All rights reserved.
Java ME Preconfigured Pin example
From: http://docs.oracle.com/javame/8.3/get-started-rpi/device-i-o-preconfigured-
list.htm#MEEPG148
Device Id
Pin name
Copyright © 2016 Accenture All rights reserved.
Java ME Hello World – Flashing LED!
GPIOPin pin18 = DeviceManager.open(“GPIO18”, GPIOPin.class);
boolean currentValue = false;
while(true){
currentValue = !currentValue;
pin18.setValue(currentValue);
System.out.println("Changing pin value to: " + currentValue);
Thread.sleep(2000);
}
Copyright © 2016 Accenture All rights reserved.
Progress so far
By Afrank99 - Own work, CC BY-SA 2.0,
https://commons.wikimedia.org/w/index.php?curid=227264
GPIOPin pin18 = DeviceManager.open(“GPIO18”, GPIOPin.class);
Pin18.setValue(true);
+
We can now turn on/off LEDs!
Copyright © 2016 Accenture All rights reserved.
Raspberry Pi Emulator Device
• Allows for local testing
• Use a preconfigured emulator device that represents pins on actual device:
https://github.com/SubOptimal/RaspberryPI_EmulatorDevice
• Download zip
• From Java ME Tools in NetBeans, select “Custom Device Emulator”
• Click Import, point to downloaded zip
Copyright © 2016 Accenture All rights reserved.
Raspberry Pi Emulated Device (2)
• Now see
RaspberryPi_EmulatorDevice
in Device Selector list
• By default – does not include
libraries, need to select in
config too
Copyright © 2016 Accenture All rights reserved.
Raspberry Pi Emulated Device (3)
Copyright © 2016 Accenture All rights reserved.
In Custom Device Editor, Edit – add required libraries for your project
e.g. Device I/O Api – Access and Control (DeviceManager api) and GPIO (for GPIO pins
api)
Java ME API Security Permissions
• Deploying first app, you’ll likely see this error (if you’re not following a tutorial):
Copyright © 2016 Accenture All rights reserved.
Java ME API Security Permissions (2)
• Select View / Device Log: “Permission check failed”
This indicates API
permissions are missing
You need to set Permissions
to access resources on the
device
From Project Properties /
Application Descriptor:
Copyright © 2016 Accenture All rights reserved.
Java ME API Security Permissions (3)
• Click Add – add open permission for each GPIO pin you need to control (or wildcard *:*):
Copyright © 2016 Accenture All rights reserved.
ME device id vs GPIO pin number error
Error:
jdk.dio.DeviceNotFoundException: Device 14 not found
- jdk/dio/DeviceManager.open(), bci=87
Check:
Are you trying to use GPIO pins ids, and not Device Ids?
e.g.
DeviceManager.open(14)
(there is no DeviceId == 14)
Copyright © 2016 Accenture All rights reserved.
Configuring GPIO pins & creating Event Listeners
• To handle button clicks (button click = event)
• Configure pin for input, and register a listener:
GPIOPin gpio4 = DeviceManager.open(new GPIOPinConfig.Builder()
.setPinNumber(GPIO4_pin)
.setDirection(GPIOPinConfig.DIR_INPUT_ONLY)
.setTrigger(GPIOPinConfig.TRIGGER_FALLING_EDGE)
.build());
gpio4.setInputListener((PinListener) this);
Copyright © 2016 Accenture All rights reserved.
Event Listeners (2)
• Implement the PinListener interface:
public class JavaMETestButton extends MIDlet implements PinListener {
// …
public void valueChanged(PinEvent event) {
//do something here!
System.out.println("gpio4 event/button press!");
}
Copyright © 2016 Accenture All rights reserved.
Default Java ME defined pin mappings
DIR_INPUT_ONLY
• GPIO4
• GPIO17
• GPIO22
• GPIO27
DIR_OUTPUT_ONLY
• GPIO7
• GPIO18
• GPIO23
• GPIO24
• GPIO25
Copyright © 2016 Accenture All rights reserved.
Pre-configured / default
pins:
Progress so far (2)
• You can now:
–Write code to interact with the physical world!
–Turn on/off pins - turn on LEDs/Lights, trigger relays
–Detect high/low on a pin - react to switch/button/sensor
Copyright © 2016 Accenture All rights reserved.
Progress so far (3)
By Afrank99 - Own work, CC BY-SA 2.0,
https://commons.wikimedia.org/w/index.php?curid
=227264
GPIOPin pin18 = DeviceManager.open(“GPIO18”, GPIOPin.class);
pin18.setValue(true);
+
Copyright © 2016 Accenture All rights reserved.
By Inductiveload - Own work, Public Domain,
https://commons.wikimedia.org/w/index.php?curid=8
385509
+
GPIOPin gpio4 = DeviceManager.open(new GPIOPinConfig.Builder()
.setPinNumber(GPIO4_pin)
.setDirection(GPIOPinConfig.DIR_INPUT_ONLY)
.setTrigger(GPIOPinConfig.TRIGGER_FALLING_EDGE)
.build());
gpio4.setInputListener((PinListener) this);
Basic building blocks for any embedded project!
Demos!
Copyright © 2016 Accenture All rights reserved.
Demo Source
https://github.com/kevinhooke/JavaMESimpleLEDTest
https://github.com/kevinhooke/RaspPiLEDsAndButtonsGame
Downloads & Useful Links
https://www.raspberrypi.org
https://netbeans.org/
http://www.oracle.com/technetwork/java/embedded/javame/javame-
sdk/downloads/javamesdkdownloads-2166598.html
Copyright © 2014 Accenture. All rights reserved.
Q&A
• Any questions?

More Related Content

What's hot

Getting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and ArduinoGetting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and ArduinoChad Mairn
 
PyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_AyanPyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_AyanAyan Pahwa
 
Linux on Open Source Hardware
Linux on Open Source HardwareLinux on Open Source Hardware
Linux on Open Source HardwareDrew Fustini
 
Using arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsUsing arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsSudar Muthu
 
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...David Fowler
 
Arduino vs Raspberry Pi | Which Board to Choose for IoT Projects | IoT Device...
Arduino vs Raspberry Pi | Which Board to Choose for IoT Projects | IoT Device...Arduino vs Raspberry Pi | Which Board to Choose for IoT Projects | IoT Device...
Arduino vs Raspberry Pi | Which Board to Choose for IoT Projects | IoT Device...Edureka!
 
Cassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshopCassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshoptomtobback
 
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-io
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-ioHome automation-in-the-cloud-with-the-esp8266-and-adafruit-io
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-ioTran Minh Nhut
 
ESP8266 and IOT
ESP8266 and IOTESP8266 and IOT
ESP8266 and IOTdega1999
 
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...Raul Chong
 
Why You Cannot Use Neural Engine to Run Your NN Models on A11 Devices?
Why You Cannot Use Neural Engine to Run Your NN Models on A11 Devices?Why You Cannot Use Neural Engine to Run Your NN Models on A11 Devices?
Why You Cannot Use Neural Engine to Run Your NN Models on A11 Devices?Koan-Sin Tan
 
Exploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source ToolsExploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source ToolsKoan-Sin Tan
 
IOT Talking to Webserver - how to
IOT Talking to Webserver - how to IOT Talking to Webserver - how to
IOT Talking to Webserver - how to Indraneel Ganguli
 
Linux Accessibility Workshop, Sun Accessibility
Linux Accessibility Workshop, Sun AccessibilityLinux Accessibility Workshop, Sun Accessibility
Linux Accessibility Workshop, Sun AccessibilityMalte Timmermann
 
Android Things - The IoT platform from Google
Android Things - The IoT platform from GoogleAndroid Things - The IoT platform from Google
Android Things - The IoT platform from GoogleEmmanuel Obot
 
Raspberry Pi Using Python
Raspberry Pi Using PythonRaspberry Pi Using Python
Raspberry Pi Using PythonSeggy Segaran
 
Raspberry pi : how to get started
Raspberry pi : how to get startedRaspberry pi : how to get started
Raspberry pi : how to get started동호 손
 
Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015mycal1
 
Scaling IoT: Telemetry, Command & Control, Analytics and the Cloud
Scaling IoT: Telemetry, Command & Control, Analytics and the CloudScaling IoT: Telemetry, Command & Control, Analytics and the Cloud
Scaling IoT: Telemetry, Command & Control, Analytics and the CloudNick Landry
 

What's hot (20)

Getting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and ArduinoGetting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and Arduino
 
PyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_AyanPyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_Ayan
 
Linux on Open Source Hardware
Linux on Open Source HardwareLinux on Open Source Hardware
Linux on Open Source Hardware
 
Remote tanklevelmonitor
Remote tanklevelmonitorRemote tanklevelmonitor
Remote tanklevelmonitor
 
Using arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsUsing arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of things
 
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
 
Arduino vs Raspberry Pi | Which Board to Choose for IoT Projects | IoT Device...
Arduino vs Raspberry Pi | Which Board to Choose for IoT Projects | IoT Device...Arduino vs Raspberry Pi | Which Board to Choose for IoT Projects | IoT Device...
Arduino vs Raspberry Pi | Which Board to Choose for IoT Projects | IoT Device...
 
Cassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshopCassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshop
 
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-io
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-ioHome automation-in-the-cloud-with-the-esp8266-and-adafruit-io
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-io
 
ESP8266 and IOT
ESP8266 and IOTESP8266 and IOT
ESP8266 and IOT
 
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
 
Why You Cannot Use Neural Engine to Run Your NN Models on A11 Devices?
Why You Cannot Use Neural Engine to Run Your NN Models on A11 Devices?Why You Cannot Use Neural Engine to Run Your NN Models on A11 Devices?
Why You Cannot Use Neural Engine to Run Your NN Models on A11 Devices?
 
Exploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source ToolsExploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source Tools
 
IOT Talking to Webserver - how to
IOT Talking to Webserver - how to IOT Talking to Webserver - how to
IOT Talking to Webserver - how to
 
Linux Accessibility Workshop, Sun Accessibility
Linux Accessibility Workshop, Sun AccessibilityLinux Accessibility Workshop, Sun Accessibility
Linux Accessibility Workshop, Sun Accessibility
 
Android Things - The IoT platform from Google
Android Things - The IoT platform from GoogleAndroid Things - The IoT platform from Google
Android Things - The IoT platform from Google
 
Raspberry Pi Using Python
Raspberry Pi Using PythonRaspberry Pi Using Python
Raspberry Pi Using Python
 
Raspberry pi : how to get started
Raspberry pi : how to get startedRaspberry pi : how to get started
Raspberry pi : how to get started
 
Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015
 
Scaling IoT: Telemetry, Command & Control, Analytics and the Cloud
Scaling IoT: Telemetry, Command & Control, Analytics and the CloudScaling IoT: Telemetry, Command & Control, Analytics and the Cloud
Scaling IoT: Telemetry, Command & Control, Analytics and the Cloud
 

Similar to [CON3189] JavaOne 2016 - Introduction to Java ME development for the Raspberry Pi

A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024Cloud Native NoVA
 
Building Better IoT Applications without Servers
Building Better IoT Applications without ServersBuilding Better IoT Applications without Servers
Building Better IoT Applications without ServersIan Massingham
 
JavaOne 2016 - Faces Counter
JavaOne 2016 -  Faces CounterJavaOne 2016 -  Faces Counter
JavaOne 2016 - Faces CounterCoritel
 
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Codemotion
 
SFScon 22 - Roberto Innocenti - Start Enjoy Yourself with Open Hardware POWER...
SFScon 22 - Roberto Innocenti - Start Enjoy Yourself with Open Hardware POWER...SFScon 22 - Roberto Innocenti - Start Enjoy Yourself with Open Hardware POWER...
SFScon 22 - Roberto Innocenti - Start Enjoy Yourself with Open Hardware POWER...South Tyrol Free Software Conference
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made EasyAlon Fliess
 
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi [Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi Tomomi Imura
 
Cayenne mydevices presentation
Cayenne  mydevices presentation Cayenne  mydevices presentation
Cayenne mydevices presentation Telexine
 
Srikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latestSrikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latestSrikanth Pilli
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Codemotion
 
Volunteer Computing using BOINC
Volunteer Computing using BOINCVolunteer Computing using BOINC
Volunteer Computing using BOINCPooyan Mehrparvar
 
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez CreamQuick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez CreamMif Masterz
 
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CA
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CAAppcelerator iPhone/iPad Dev Con 2010 San Diego, CA
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CAJeff Haynie
 
iPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumiPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumAxway Appcelerator
 
Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...Dawn Wages
 
ApacheCloudStack
ApacheCloudStackApacheCloudStack
ApacheCloudStackPuppet
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackke4qqq
 
eXoer on the grill: eXo Add-ons factory using Docker and Codenvy
eXoer on the grill: eXo Add-ons factory using Docker and CodenvyeXoer on the grill: eXo Add-ons factory using Docker and Codenvy
eXoer on the grill: eXo Add-ons factory using Docker and CodenvyeXo Platform
 
Introduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIOIntroduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIOKris Findlay
 

Similar to [CON3189] JavaOne 2016 - Introduction to Java ME development for the Raspberry Pi (20)

A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
 
Building Better IoT Applications without Servers
Building Better IoT Applications without ServersBuilding Better IoT Applications without Servers
Building Better IoT Applications without Servers
 
JavaOne 2016 - Faces Counter
JavaOne 2016 -  Faces CounterJavaOne 2016 -  Faces Counter
JavaOne 2016 - Faces Counter
 
C2M - App design
C2M - App designC2M - App design
C2M - App design
 
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
 
SFScon 22 - Roberto Innocenti - Start Enjoy Yourself with Open Hardware POWER...
SFScon 22 - Roberto Innocenti - Start Enjoy Yourself with Open Hardware POWER...SFScon 22 - Roberto Innocenti - Start Enjoy Yourself with Open Hardware POWER...
SFScon 22 - Roberto Innocenti - Start Enjoy Yourself with Open Hardware POWER...
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi [Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
 
Cayenne mydevices presentation
Cayenne  mydevices presentation Cayenne  mydevices presentation
Cayenne mydevices presentation
 
Srikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latestSrikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latest
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Volunteer Computing using BOINC
Volunteer Computing using BOINCVolunteer Computing using BOINC
Volunteer Computing using BOINC
 
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez CreamQuick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
 
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CA
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CAAppcelerator iPhone/iPad Dev Con 2010 San Diego, CA
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CA
 
iPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumiPhone/iPad Development with Titanium
iPhone/iPad Development with Titanium
 
Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...
 
ApacheCloudStack
ApacheCloudStackApacheCloudStack
ApacheCloudStack
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStack
 
eXoer on the grill: eXo Add-ons factory using Docker and Codenvy
eXoer on the grill: eXo Add-ons factory using Docker and CodenvyeXoer on the grill: eXo Add-ons factory using Docker and Codenvy
eXoer on the grill: eXo Add-ons factory using Docker and Codenvy
 
Introduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIOIntroduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIO
 

Recently uploaded

Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideStefan Dietze
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?Paolo Missier
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingScyllaDB
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 

Recently uploaded (20)

Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 

[CON3189] JavaOne 2016 - Introduction to Java ME development for the Raspberry Pi

  • 1. Introduction to Java ME for the Raspberry Pi [JavaOne 2016 CON3189] Kevin Hooke Julio Palma Vazquez
  • 2. Who Are We? Copyright © 2016 Accenture All rights reserved. Kevin Hooke Technology Architect Accenture Java Community Champion @kevinhooke Julio Palma Technology Architect Accenture Java Community Champion @restalion
  • 3. Related Sessions JavaOne 2016 Monday, Sep 19 Tuesday, Sep 20 Wednesday, Sep 21 Introduction to Java ME 8 [CON3189] Java ME and Single-Board Computers for Creating Industrial Middleware [CON3187] All Your Faces Belong to Us: Building an Open Face Recognition Platform [CON6217] 12:30 p.m. - 1:30 p.m 2:30 p.m. - 3:30 p.m 3:00 p.m. - 4:00 p.m Hilton - Golden Gate 6/7/8 Hilton - Golden Gate 6/7/8 Hilton - Golden Gate 6/7/8 Kevin Hooke Julio Palma Jorge Hidalgo Julio Palma Jorge Hidalgo Mariano Rodriguez Copyright © 2016 Accenture All rights reserved.
  • 4. Session Goals Copyright © 2016 Accenture All rights reserved. Java ME SDK + IDE Plugins+ + + By Afrank99 - Own work, CC BY-SA 2.0, https://commons.wikimedia.org/w/index.php?curid=227264 By Inductiveload - Own work, Public Domain, https://commons.wikimedia.org/w/index.php?curid=8385509
  • 5. Session Goals Copyright © 2016 Accenture All rights reserved. Java ME SDK + IDE Plugins+ + + By Afrank99 - Own work, CC BY-SA 2.0, https://commons.wikimedia.org/w/index.php?curid=227264 By Inductiveload - Own work, Public Domain, https://commons.wikimedia.org/w/index.php?curid=8385509 Build one of these:
  • 6. Getting Started: Required Setup Dev tools: • Java ME SDK 8.3 (for Window or Linux) • NetBeans 8.1 (Or Eclipse) • NetBeans Java ME SDK 8.3 plugins (Or Eclipse) Raspberry Pi runtime: • Raspberry Pi (although can develop with emulator in ME SDK) • Raspbian • Java ME Embedded 8.3 for Raspberry Pi Copyright © 2016 Accenture All rights reserved.
  • 7. NetBeans setup • Tools / Plugins / Settings tab, Add new ‘Update Center’ • Point to unzipped Java ME SDK plugins in a dir using file:// On Windows: • Use file:/// • path to folder with no spaces in name works best) Copyright © 2016 Accenture All rights reserved.
  • 8. NetBeans setup (2) • ‘Available plugins’ tab • Select: • Java ME SDK Tools • Java ME SDK Demos • Press Install • Ok and restart NetBeans when prompted Copyright © 2016 Accenture All rights reserved.
  • 9. NetBeans setup (3) • ME SDK Welcome displayed on restart: Copyright © 2016 Accenture All rights reserved.
  • 10. Creating a new ME Project • File / New Project / Java ME Embedded Copyright © 2016 Accenture All rights reserved.
  • 11. Creating a new ME project (2) • Defaults will use an emulated Embedded Device • Emulated devices and connections to real hardware provided by Java ME SDK Device Manager (Windows and Linux) Copyright © 2016 Accenture All rights reserved.
  • 12. Raspberry Pi setup • SCP/SFTP Java ME JDK zip for Raspberry Pi to your Pi • Unzip, cd to bin • ./fix_permissions.sh • Run with: sudo ./usertest.sh Copyright © 2016 Accenture All rights reserved.
  • 13. Connect Device Manager to Java ME on Pi • Press ‘+’ in Device Connection Manager • If connected over network, give IP of the remote Pi (might auto detect) • Should see connection status listed as connected (below): Copyright © 2016 Accenture All rights reserved.
  • 14. Publish project to Pi • Change Project Properties on Project • Select ‘Platform’ • Change ‘Device’ to newly added Raspberry Pi Copyright © 2016 Accenture All rights reserved.
  • 15. Java ME Hello World! • Instead of a simple (typical) System.out.println() • Internet of Things (IoT) and embedded devices are all about hardware • Let’s say ‘Hello World’ with a flashing LED! • First need to understand available GPIO pins on the Pi Copyright © 2016 Accenture All rights reserved.
  • 16. Raspberry Pi GPIO pins • Pins for Input and Output – 3.3v • For interacting with external devices: switches, LEDs, sensors etc • Building blocks for building IoT type solutions! From: Herbfargus - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=47497384 Copyright © 2016 Accenture All rights reserved.
  • 17. Raspberry Pi GPIO pins(2) • What pin does what? (not all are GPIO) • Raspberry Pi docs site shows which pins are power/ground, and GPIO • Interactive online diagrams, like https://pinout.xyz/ From: https://www.raspberrypi.org/documentation/usage/gpio-plus-and- raspi2/README.md Copyright © 2016 Accenture All rights reserved.
  • 18. Java ME and GPIO Pins DeviceManager.open(int) • refers to GPIO pin by Device Id (NOT GPIO pin number) • e.g. 1 == GPIO4 • See mappings in docs here: http://docs.oracle.com/javame/8.3/get-started-rpi/device-i-o-preconfigured- list.htm#MEEPG148 Copyright © 2016 Accenture All rights reserved.
  • 19. Java ME and GPIO Pins DeviceManager.open(int) • refers to GPIO pin by Device Id (NOT GPIO pin number) • e.g. 1 == GPIO4 • See mappings in docs here: http://docs.oracle.com/javame/8.3/get-started-rpi/device-i-o-preconfigured- list.htm#MEEPG148 Less confusing – open by “pin name”, e.g. “GPIO4” DeviceManager.open(“GPIO4”, GPIOPin.class) • Refers to pin by configured name, e.g. “GPIO4”. • Mappings defined in same doc above Copyright © 2016 Accenture All rights reserved.
  • 20. Java ME Preconfigured Pin example From: http://docs.oracle.com/javame/8.3/get-started-rpi/device-i-o-preconfigured- list.htm#MEEPG148 Device Id Pin name Copyright © 2016 Accenture All rights reserved.
  • 21. Java ME Hello World – Flashing LED! GPIOPin pin18 = DeviceManager.open(“GPIO18”, GPIOPin.class); boolean currentValue = false; while(true){ currentValue = !currentValue; pin18.setValue(currentValue); System.out.println("Changing pin value to: " + currentValue); Thread.sleep(2000); } Copyright © 2016 Accenture All rights reserved.
  • 22. Progress so far By Afrank99 - Own work, CC BY-SA 2.0, https://commons.wikimedia.org/w/index.php?curid=227264 GPIOPin pin18 = DeviceManager.open(“GPIO18”, GPIOPin.class); Pin18.setValue(true); + We can now turn on/off LEDs! Copyright © 2016 Accenture All rights reserved.
  • 23. Raspberry Pi Emulator Device • Allows for local testing • Use a preconfigured emulator device that represents pins on actual device: https://github.com/SubOptimal/RaspberryPI_EmulatorDevice • Download zip • From Java ME Tools in NetBeans, select “Custom Device Emulator” • Click Import, point to downloaded zip Copyright © 2016 Accenture All rights reserved.
  • 24. Raspberry Pi Emulated Device (2) • Now see RaspberryPi_EmulatorDevice in Device Selector list • By default – does not include libraries, need to select in config too Copyright © 2016 Accenture All rights reserved.
  • 25. Raspberry Pi Emulated Device (3) Copyright © 2016 Accenture All rights reserved. In Custom Device Editor, Edit – add required libraries for your project e.g. Device I/O Api – Access and Control (DeviceManager api) and GPIO (for GPIO pins api)
  • 26. Java ME API Security Permissions • Deploying first app, you’ll likely see this error (if you’re not following a tutorial): Copyright © 2016 Accenture All rights reserved.
  • 27. Java ME API Security Permissions (2) • Select View / Device Log: “Permission check failed” This indicates API permissions are missing You need to set Permissions to access resources on the device From Project Properties / Application Descriptor: Copyright © 2016 Accenture All rights reserved.
  • 28. Java ME API Security Permissions (3) • Click Add – add open permission for each GPIO pin you need to control (or wildcard *:*): Copyright © 2016 Accenture All rights reserved.
  • 29. ME device id vs GPIO pin number error Error: jdk.dio.DeviceNotFoundException: Device 14 not found - jdk/dio/DeviceManager.open(), bci=87 Check: Are you trying to use GPIO pins ids, and not Device Ids? e.g. DeviceManager.open(14) (there is no DeviceId == 14) Copyright © 2016 Accenture All rights reserved.
  • 30. Configuring GPIO pins & creating Event Listeners • To handle button clicks (button click = event) • Configure pin for input, and register a listener: GPIOPin gpio4 = DeviceManager.open(new GPIOPinConfig.Builder() .setPinNumber(GPIO4_pin) .setDirection(GPIOPinConfig.DIR_INPUT_ONLY) .setTrigger(GPIOPinConfig.TRIGGER_FALLING_EDGE) .build()); gpio4.setInputListener((PinListener) this); Copyright © 2016 Accenture All rights reserved.
  • 31. Event Listeners (2) • Implement the PinListener interface: public class JavaMETestButton extends MIDlet implements PinListener { // … public void valueChanged(PinEvent event) { //do something here! System.out.println("gpio4 event/button press!"); } Copyright © 2016 Accenture All rights reserved.
  • 32. Default Java ME defined pin mappings DIR_INPUT_ONLY • GPIO4 • GPIO17 • GPIO22 • GPIO27 DIR_OUTPUT_ONLY • GPIO7 • GPIO18 • GPIO23 • GPIO24 • GPIO25 Copyright © 2016 Accenture All rights reserved. Pre-configured / default pins:
  • 33. Progress so far (2) • You can now: –Write code to interact with the physical world! –Turn on/off pins - turn on LEDs/Lights, trigger relays –Detect high/low on a pin - react to switch/button/sensor Copyright © 2016 Accenture All rights reserved.
  • 34. Progress so far (3) By Afrank99 - Own work, CC BY-SA 2.0, https://commons.wikimedia.org/w/index.php?curid =227264 GPIOPin pin18 = DeviceManager.open(“GPIO18”, GPIOPin.class); pin18.setValue(true); + Copyright © 2016 Accenture All rights reserved. By Inductiveload - Own work, Public Domain, https://commons.wikimedia.org/w/index.php?curid=8 385509 + GPIOPin gpio4 = DeviceManager.open(new GPIOPinConfig.Builder() .setPinNumber(GPIO4_pin) .setDirection(GPIOPinConfig.DIR_INPUT_ONLY) .setTrigger(GPIOPinConfig.TRIGGER_FALLING_EDGE) .build()); gpio4.setInputListener((PinListener) this); Basic building blocks for any embedded project!
  • 35. Demos! Copyright © 2016 Accenture All rights reserved.
  • 37. Downloads & Useful Links https://www.raspberrypi.org https://netbeans.org/ http://www.oracle.com/technetwork/java/embedded/javame/javame- sdk/downloads/javamesdkdownloads-2166598.html
  • 38. Copyright © 2014 Accenture. All rights reserved. Q&A • Any questions?