SlideShare uma empresa Scribd logo
1 de 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?

Mais conteĂșdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a [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
 
iPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumiPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumAxway Appcelerator
 
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
 
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
 
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
 
ApacheCloudStack
ApacheCloudStackApacheCloudStack
ApacheCloudStackPuppet
 
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
 

Semelhante a [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
 
iPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumiPhone/iPad Development with Titanium
iPhone/iPad Development with Titanium
 
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
 
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...
 
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
 
ApacheCloudStack
ApacheCloudStackApacheCloudStack
ApacheCloudStack
 
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
 

Último

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂșjo
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 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?