Posts: 1
Joined: Fri Apr 20, 2018 6:30 pm

Java ME: Read from GPIO

Fri Apr 20, 2018 6:32 pm

I'm trying to access the GPIOs within Java ME but I'm not able to get it running. Could someone provide me some example? There aren't clear examples on the web. I'm using Raspberry Pi 3 with the ds18b20 sensor connected on GPIO 4 and I'd like to get the temperature.

Code: Select all

import javax.microedition.midlet.MIDlet;
import jdk.dio.DeviceManager;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.gpio.GPIOPin;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import jdk.dio.gpio.GPIOPort;

class Temperature extends MIDlet {
     private GPIOPort port_a;
     public void startApp() {
            System.out.println("Ready to work");

        }catch (UnavailableDeviceException ex) {
        }catch (IOException ex) {


    public void destroyApp(boolean unconditional) {
            System.out.println("Good-bye Pi!!!");


Return to “Java”

Who is online

Users browsing this forum: No registered users and 3 guests