SlideShare a Scribd company logo
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 Arduino
Chad Mairn
 
PyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_AyanPyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_Ayan
Ayan Pahwa
 
Linux on Open Source Hardware
Linux on Open Source HardwareLinux on Open Source Hardware
Linux on Open Source Hardware
Drew Fustini
 
Remote tanklevelmonitor
Remote tanklevelmonitorRemote tanklevelmonitor
Remote tanklevelmonitor
Parshwadeep Lahane
 
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
Sudar 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 workshop
tomtobback
 
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
Tran Minh Nhut
 
ESP8266 and IOT
ESP8266 and IOTESP8266 and IOT
ESP8266 and IOT
dega1999
 
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 Tools
Koan-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 Accessibility
Malte 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 Google
Emmanuel Obot
 
Raspberry Pi Using Python
Raspberry Pi Using PythonRaspberry Pi Using Python
Raspberry Pi Using Python
Seggy 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/2015
mycal1
 
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
Nick 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 2024
Cloud Native NoVA
 
Building Better IoT Applications without Servers
Building Better IoT Applications without ServersBuilding Better IoT Applications without Servers
Building Better IoT Applications without Servers
Ian Massingham
 
JavaOne 2016 - Faces Counter
JavaOne 2016 -  Faces CounterJavaOne 2016 -  Faces Counter
JavaOne 2016 - Faces Counter
Coritel
 
C2M - App design
C2M - App designC2M - App design
C2M - App design
rohanratnaparkhi
 
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
Codemotion
 
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 Easy
Alon 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_latest
Srikanth 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 BOINC
Pooyan 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 Cream
Mif 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, CA
Jeff Haynie
 
iPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumiPhone/iPad Development with Titanium
iPhone/iPad Development with Titanium
Axway 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
ApacheCloudStack
Puppet
 
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
ke4qqq
 
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
eXo Platform
 
Introduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIOIntroduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIO
Kris 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

How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 

Recently uploaded (20)

How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 

[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?