GPIO sample - raspberry

Hello

I work with the sample GPIO for the ME. I would like to know what is the right way to get the job of the sample on a RaspberryPi? I think that it is possible to set XML properties to do this? But how. changing the direct code does the work. I know, but I would like to know how to make a sort of default installation RaspberryPi.

Thanx. Harald

Hello

That solved. It took me some time to learn how to change a JAD property. Now it's working. I used the project properties page and add a custom attribute "GPIOSample-ButtonId" with a numeric value in the element of the Application descriptor and the attributes tab. Now the demo works.

Tags: Java

Similar Questions

  • Sample SDK 8.2 ME GPIO - headphone works not

    Hello

    Someone out there who got the GPIO sample in SDK 8.2 working ME with the Raspberry Pi. For me only LED output curious work after his arrival around some pin assignments between SDK and RPi.

    Now I have my compiled program and successfully started, but the listener is not called if I change the voltage on the corresponding pin of RPi level.

    I read

    The triggering modes TRIGGER_HIGH_LEVEL , TRIGGER_LOW_LEVEL , and TRIGGER_BOTH_LEVELS are not supported on the Raspberry Pi.

    But triggers are set by the defaultTRIGGER_BOTH_EDGES

    1GPIO4GPIO 4controllerNumber = 0

    pinNumber = 4

    direction = GPIOPinConfig.DIR_INPUT_ONLY

    mode = DeviceConfig.DEFAULT

    trigger = GPIOPinConfig.TRIGGER_BOTH_EDGES

    initValue-ignored

    This is the reason to listeners.

    Best regards, harald

    I'm sorry. That solved. It is correct. The RPI is not able to work with the predefined trigger properties. so I used

    button.setTrigger (GPIOPinConfig.TRIGGER_BOTH_EDGES)

    and the IPD called the listener. Fine.

    Best regards, harald

  • Raspberry Pi 2B Mod - GPIO how

    Hello

    I am usind a raspberry Pi 2 Mod B with NetBeans 8.1, Oracle JDK ME 8.2. I created is the compilation of all connections and the example program GPIOSample and currently running on th RPi, but none of the pins work. After that, I took off all the extra stuff and only use code to set the output pin 7. Added code to define and redefine the value of pines. Who compiles also but I do not see any work spindle. From my point of view, it should be RPi GPIO 26 socket number. What am I wrong douing?

    Best regards, harald

    Code should go in GPIOSample

    /*

    * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.

    */

    package com.oracle.jmee.samples.gpio;

    import java.io.IOException;

    Import javax.microedition.midlet.MIDlet;

    Import jdk.dio.DeviceManager;

    Import jdk.dio.gpio.GPIOPin;

    /**

    * GPIOSample illustrates the basic GPIO functionality. The example opens the

    * following DIO devices:

    */

    SerializableAttribute public class GPIOSample extends MIDlet {}

    GPIO pins that matches an LED

    Led private GPIOPin = null;

    @Override

    public void startApp() {}

    System.out.println("***");

    System.out.println ("* GPIO sample started!")           *");

    System.out.println("***");

    try {}

    int ledPinId = 7;

    System.out.println ("Pin GPIO opening with the id" + ledPinId + "for the LED");

    LED = DeviceManager.open (ledPinId);

    System.out.println ("Success opening GPIO pin code" + ledPinId + "for the LED");

    } catch (IOException ex) {}

    System.out.println ("could not open pin");

    destroyApp (true);

    }

    boolean Val = true;

    for (int i = 0; i < 20; i ++)

    {

    try {}

    Thread.Sleep (500); I know. Should not be done. Only for the test

    }

    catch (InterruptedException ex)

    {

    System.out.println("!!! «) ""Interrupted exception");

    }

    try {}

    Val =! led.getValue ();

    led.setValue (val);

    }

    catch (IOException ex) {}

    System.out.println ("catch IOException ex");

    }

    System.out.println ("* next change of State:" + i + "is" + val);

    }

    destroyApp (true);

    }

    @Override

    {} public void destroyApp (boolean unconditional)

    System.out.println("***");

    System.out.println ("* sample destroyed GPIO *");

    System.out.println("***");

    notifyDestroyed();

    }

    }

    You have the permission of the api?

    I just got my LED project work this afternoon, I had trouble with the code. You can try this to see if your works. Sound like we have the same configuration.

    A few quick notes. It seems that you must set the PIN every time by:

    Config1 GPIOPinConfig = new GPIOPinConfig (0.22, GPIOPinConfig.DIR_OUTPUT_ONLY, DeviceConfig.UNASSIGNED, 0, false);

    Then call the pin code

    Pin 1 = DeviceManager.open (config1) GPIOPin;

    and a quick fix test to disable the pin code then.

    PIN1. SetValue (true);

    Thread.Sleep (4000);

    PIN1. Close();

    Used II pin GPIO 22 which is actual pin 15 of the Governing Council.

    If you need more made me know, would be happy to help you.

    I can send you my entire script if you wish

    Adam

  • Q:PeripheralTypeNotSupportedException on GPIO18

    Hello
    I just started to tinker around with Oracle Java ME on my raspberry PI 3.3 and have lots of fun and a question that I don't understand or how to fix.

    I try to turn on or turn off some lights just to learn more about the DAAPI, etc.. My code looks like this (Yes, I know it can be written better, but I'm learning about the DAAPI for now):
    package rpiblinky;
    
    import com.oracle.deviceaccess.PeripheralManager;
    import com.oracle.deviceaccess.PeripheralNotAvailableException;
    import com.oracle.deviceaccess.PeripheralNotFoundException;
    import com.oracle.deviceaccess.PeripheralTypeNotSupportedException;
    import com.oracle.deviceaccess.gpio.GPIOPin;
    import java.io.IOException;
    import javax.microedition.midlet.*;
    
    /**
     * @author atael
     */
    public class IMlet extends MIDlet {
    
        private static final String LED1_NAME = "GPIO23";
        private static final String LED2_NAME = "GPIO24";
        private static final String LED3_NAME = "GPIO25";
        private static final String LED4_NAME = "GPIO18";
        private LED led1;
        private LED led2;
        private LED led3;
        private LED led4;
        boolean isStarted = false;
    
        public void startApp() {
            isStarted = true;
            System.out.println("*********************************");
            System.out.println("*   LED GPIO Sample (RPI Blinky)*");
            System.out.println("*********************************");
    
            led1 = new LED(LED1_NAME);
            led2 = new LED(LED2_NAME);
            led3 = new LED(LED3_NAME);
            led4 = new LED(LED4_NAME);
            try {
                led1.open();
                led2.open();
                led3.open();
                led4.open();
                while (true) {
                    led1.changeValue();
                    Thread.sleep(50);
                    led2.changeValue();
                    Thread.sleep(50);
                    led3.changeValue();
                    Thread.sleep(50);
                    led3.changeValue();
                    Thread.sleep(50);
                    led2.changeValue();
                    Thread.sleep(50);
                    led1.changeValue();
                    Thread.sleep(50);
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (PeripheralTypeNotSupportedException ex) {
                ex.printStackTrace();
            } catch (PeripheralNotFoundException ex) {
                ex.printStackTrace();
            } catch (PeripheralNotAvailableException ex) {
                ex.printStackTrace();
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
    
        }
    
        public void pauseApp() {
        }
    
        public void destroyApp(boolean unconditional) {
            try {
                isStarted = false;
                led1.close();
                led2.close();
                led3.close();
                led4.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (PeripheralNotAvailableException ex) {
                ex.printStackTrace();
            }
        }
    
        public class LED {
    
            private String name;
            private GPIOPin led;
    
            LED(String name) {
                this.name = name;
            }
    
            public void open() throws IOException, PeripheralTypeNotSupportedException,
                    PeripheralNotFoundException, PeripheralNotAvailableException {
                led = (GPIOPin) PeripheralManager.open(name, GPIOPin.class, null);
            }
    
            public void changeValue() {
                try {
                    boolean prevState = led.getValue();
                    led.setValue(!prevState);
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (PeripheralNotAvailableException ex) {
                    ex.printStackTrace();
                }
            }
    
            public void close() throws IOException, PeripheralNotAvailableException {
                if (led != null) {
                    led.setValue(false);
                    led.close();
                }
            }
        }
    }
    But when I run the application I the following exception is thrown:
    *********************************
    *   LED GPIO Sample (RPI Blinky)*
    *********************************
    [INFO] [UNKNOWN] gpio.c line 636: Try to open pin 23 on port 0 with direction 1
    [INFO] [UNKNOWN] gpio.c line 727: GPIO pin 23 open successfully done
    [INFO] [UNKNOWN] gpio.c line 636: Try to open pin 24 on port 0 with direction 1
    [INFO] [UNKNOWN] gpio.c line 727: GPIO pin 24 open successfully done
    [INFO] [UNKNOWN] gpio.c line 636: Try to open pin 25 on port 0 with direction 1
    [INFO] [UNKNOWN] gpio.c line 727: GPIO pin 25 open successfully done
    [AMS-TRACE] MIDlet:RPIBlinky status=2
    com.oracle.deviceaccess.PeripheralTypeNotSupportedException
     - com.oracle.deviceaccess.gpio.impl.GPIOPinImpl.openPinWithId0(), bci=0
     - com.oracle.deviceaccess.gpio.impl.GPIOPinImpl.open(), bci=57
     - com.oracle.deviceaccess.gpio.impl.GPIOManager.createPin(), bci=37
     - com.oracle.deviceaccess.gpio.impl.GPIOManager.openPin(), bci=12
     - com.oracle.deviceaccess.gpio.impl.GPIOManager.open(), bci=17
     - com.oracle.deviceaccess.impl.PeripheralManagerImpl.open(), bci=66
     - com.oracle.deviceaccess.PeripheralManager.open(), bci=4
     - rpiblinky.IMlet$LED.open(IMlet.java:105)
     - rpiblinky.IMlet.startApp(IMlet.java:44)
     - javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
     - com.sun.midp.midlet.MIDletPeer.startApp(), bci=5
     - com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=229
     - com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=38
     - com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=5
     - com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=121
     - com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26
    [AMS-TRACE] MIDlet:RPIBlinky status=1
    But if I remove the GPIO18 (led4) from my code, it performs very well. Why this would not work for me? GPIO18, GPIO23, GPIO24 and GPIO25 looks the same in the documentation:
    direction=GPIOPinConfig.DIR_OUTPUT_ONLY
    mode=GPIOPinConfig.MODE_OUPUT_PUSH_PULL
    trigger = ignored
    initValue=false
    I don't know where to start looking, what I'm doing wrong here?

    Thank you
    Andy

    Published by: a Tael on March 15, 2013 16:02

    Hello

    You must add the "deviceaccess.gpio.pin18.port = 0" line to the file jwc_properties.ini in the bin directory.

    This bug in the release configuration.

  • Debug the sample GPIO

    Hello

    I installed NETBEANS with ME and a raspberry. Now, I'm trying to understand how the sample GPIO. To do this, I would get the debugger works. It does not not as expected.

    • First I start the program with the debug key
    • Then I attached the debugger with port displayed in the debugger window.

    In the debugger window, I get the following error message:

    Starting emulator in debug server on port 53964 mode

    C:\Users\hsattm72\Documents\NetBeansProjects\GPIOSample\nbproject\build-impl.XML:844: The following error occurred during the execution of this line:

    C:\Users\hsattm72\Documents\NetBeansProjects\GPIOSample\nbproject\build-impl.XML:849: Property ${src.dir} must point to the valid source root directory.

    BUILD FAILED (total duration: 38 seconds)

    What I am doing wrong? What should I do?

    Thanks for the help, Harald.

    Hi Harald,.

    There is a known issue in the samples, which will be fixed in the next version. To solve the problem locally you must replace all entries in src.src.dir by src.dir in /nbproject/build-impl.xml and /nbproject/project.xml.

    Thank you

    Dmitry

  • Driver GPIO ME SDK 8.2 sample - reported an error

    Hello.

    I put the JAD GPIOSample-ButtonId property to 1 but receive an error to run this example on the Raspberry Pi B.1

    Could not open the GPIO PIN for the button: pilot reported an error

    I would like to know what the error is reported by the driver, but he has no clue. A few ideas.

    Some messages of most trinkets in the console of the RPi for usertest.sh:

    [ERROR] ISO [DAAPI] = - 1:Can not open file/sys/class/gpio/gpio4/direction to set the direction of GPIO PIN. Operation not permitted.

    I can't find this file on the file system. what it means?

    Cordially, harald.

    Hello

    I solved this problem. I forgot to uninstall Midlets opening this pins. While I had the correct permissions but the PIN, I wanted to use was occupied by a few other Midlet. If the driver reported an error. This is correct behavior. So delete all Midlets before running the tests.

    was my fault. I'm sorry.

  • Problem to access the GPIO

    Hello

    I am writing an application using JAVA ME for raspberry pi. I use Java ME SDK 8.0 GA.

    I'm doing a very basic action, open GPIO, turn on and then turn off, but I'm not able to get this working. My application also uses i2c and it works.

    I've tried both

    DeviceManager.open (7)

    DeviceManager.open (7, GPIOPin.class, null)

    I get the following exception:

    [ERROR] ISO [DAAPI] = - 1:There is an unexpected error when open pin GPIO 7

    I have the following permissions on my application:

    MIDlet-Permission-1: jdk.dio.DeviceMgmtPermission "*: *" 'open '.

    MIDlet-Permission-2: jdk.dio.i2cbus.I2CPermission "*: *" 'open '.

    3 MIDlet-permission-: jdk.dio.generic.GenericPermission "*: *" 'open '.

    MIDlet-Permission-4: jdk.dio.gpio.GPIOPinPermission ' *.» ' * ' 'open '.

    6 MIDlet-permission-: jdk.dio.gpio.GPIOPortPermission ' * ' 'open '.

    MIDlet-Permission-9: null java.util.logging.LoggingPermission "control".

    The application is signed with a certificate and it works like the I2C has no problem getting the required permissions and running on the Board.

    I know my PIN GPIO 7 works I have a relay that is connected to it and I am able to enable or disable the file system (echo 1 > >/sys/class/gpio/gpio7/value).

    In addition, I install the application using the jar (NOT the jad file) using the terminal. The emulator seems to fail, and I read somewhere that it is a known bug.

    I ran this code and sudo as root, but nothing helped.

    Any help would be appreciated.

    Sergei Hello / All,

    I managed to solve this problem. If the PIN is set output or input until the code is executed, then I get this exception. If the pin code is not defined a priori (whether as input or output), then the code works.

    Now, that brings to a new question, what happens if the PIN is set out by another application or manually (echo 7 >/sys/class/gpio/export) and I still need my code to work with it?

    Thank you

  • Confusion of GPIO port

    Hello teachers,.

    In Lession 2-2, the first slide mentions the "GPIO pins that are part of the GPIO port can be retrieved or controlled individually as GPIO pins. However throughout the lesson we are controlling some GPIO pins individually (defining the LEDs on and off voltage etc.). Given that all the pins are grouped under port 0, I'm confused by this statement on the slide. Perhaps I misunderstand the term 'control '?

    Thank you.

    Hi Trinity (great username, incidentally).

    Yes, I think we should have prefaced that comment a bit.  As says the javadoc for GPIOPort

    «Note that if the GPIO pins that are part of a GPIO port can be retrieved and controlled individually as GPIOPin instances depends on the hardware configuration and the platform (and especially if the GPIO pins can be shared across different abstractions).»

    So in the case of the Raspberry Pi - this statement does not apply.

    Tom

  • JavaFX should be installed for ports gpio raspi in java programming?

    I have a question. I watched the tutorials to youtube of vinicius senger

    and, he said, that JavaFX should be installed on my raspberry pi.

    But I don't understand why...  JavaFX is used for graphics is not it?

    So why am I need to install (and overclock my IP I want to do in fact...)

    When I want to just program my gpio in java ports?

    I understand why should I install pi4g and wiringpi, but what I really need to install JavaFX?

    Tanks to support fast and pleasant.

    Hello

    In fact we provide instructions on how to configure javafx, if you want to use. It comes with JDK1.8.0 anyway and you do not need to use GPIO.

    So, if you want to play with GPIO, go ahead and jump all the instructions of JavaFX.

    Vinicius-

  • Raspberry Pi emulator

    I am looking an emulator of raspberry pie, do you recommend me another alternative to emulation Raspberry Pi for Windows | Free downloads of software on SourceForge.net ?

    Hello Cesar,

    If you are looking for the emulator test regular Java applications, if your PC can do! You have to run the application on your PC and if it's ok, just transfer to the RPi. But, in the case of use of sensors, actuators and etc through the GPIO, so it will be pretty difficult... For JAva SE embedded, we do not have a standard API for GPIO and most developers use PI4J to do and you can emulate. When using Java ME embedded 8, here, we have enough good news around GPIO API Access Device and Netbeans 8! Take a look at debugging tools / emulators for NB8 and Java ME8.

    We assume to have similar features for Java SE in the near future!

    Let's look forward.

    Please let me know if you need additional support.

    Best regards

    Vinicius Senger

  • Java ME Embedded support MCBSTM32F200 KEIL and Raspberry Pi model B ONLY?

    I'm a developer JEE and completely new to Java ME Embedded (just started 12 hours ago), I'm confused in the following questions, please help, thank you!

    1 Java ME Embedded 3.3 is supported MCBSTM32F200 KEIL and Raspberry Pi model B ONLY? Or any architecture 11/Linux ARM Cortex M3 / RTX and ARMS? If sustained integrated Board/architecture list?

    2. If the answer to #1 is no, it means I have the KEIL MCBSTM32F200 reference implementation can be used on any architecture ARM Cortex M3/RTX and Raspberry Pi model B can be used on any architecture ARM 11?

    3. If the answer to #1 is no, how can I choose the jury boarded for Java ME Embedded for general use (give a recommendation is ok)?

    4. If the answer to #1 is YES, it should be to limit the use of Java ME Embedded on MCBSTM32F200 KEIL and Raspberry Pi model B; and it cannot be used on other embedded device. Or I have to choose built-in Java ME Client or Java SE embedded (this may take more resources, but I have limitted resources)? Is my understanding correct? Fact Java ME embedded has the road map to support broad embedded?

    Thanks for your time!

    Best regards

    Michael

    Hi Michael,

    Sorry for the slow response. A few responses:

    Our platform Cortex-M with on-board support for Java ME 3.3 is the KEIL MCBSTM32F200, which is based on the STM32F207 chip. There is a very similar STMF32407 chip, which is used on MCBSTM32F400 KEIL and we checked that Java ME Embedded 3.3 works there as well. It is likely that Java ME Embedded runs on other platforms using the STM32F207 or shavings of 407, but it is impossible to check all these platforms. If you have a chance to try one of those we'd love to hear about your experiences.

    For Java ME Embedded on ARM11/Linux: RasPi Mod B is our platform support. Unfortunately, Linux support for some devices required by Java ME Embedded (such as I2C and GPIO) is incompatible - it is a function of the State of Linux device drivers, not Java ME Embedded. We are looking by providing the broadest support for ARM/Linux platforms in the future, which is not difficult, but we have not only got around him.

    Generally, when they decide to specific material for a particular use case it depends a lot on the details. If it's a custom system based on the STM32F207 or 407 chips then the need for the porting/customizing Java ME Embedded should be minimal. If it's a custom ARM/Linux-based system, please contact us as we are already looking for expanding support for ARM/Linux. Finally, if you are targeting a system that is very different from the above, then you can work with Oracle or Oracle partners for optimized Java ME port built into your platform.

    Finally, we intend to provide support for additional platforms in the near future - stay tuned for announcements.

    I hope this helps. Let me know if you have any other questions.

    Best,

    Terrence Barr

    Product Manager, Oracle

  • Libraries of different ESX24 samples?

    Please can someone explain why I find different versions of the libraries of the ESX24 samples in Logic Pro X? Let me give you an example: if I create a new track of software and go to Orchestral-> Strings, I see this in the library:

    But if I create a new track of software, select EXS24 in the channel strip and then go to the Orchestral-> Strings, I see this in the library:

    Are these different samples? And stored in different places?

    Hi Broadskins, when you click on left of the channel strip settings (placed above the area of the EQ) that you look at the PATCHES of library, not the sounds of ESX24. (your first photo attached)

    When you click on left the ESX24 (or any that you instrument can be loaded) you look at its sounds from library or its own presets. (your second photo attached)

    Don't forget the small BLUE arrow on the left of the boxes is that you said that you look in the

    Library on the left.

  • Specific sampling rate?

    So maybe this is a stupid question, but I need to know because I train for a specific sound. Is there a way [to logic] to shoot/change of a certain frequency sampling rates. I can imitate the sound I'm looking for with a low pass filter, reverb and a distortion. But I don't want to 'emulate', this sound, I want to create. Then I can put my own effects and play with it like I want to. If I have to use a bunch of effects to make it sound like I want that also the addition of said effects remove the sound and sound horrible. as to where pulling the sampling frequency of the high frequency and no downs will make me THE noise that I need and always allow to add nice effects to make MY sound instead of someone else. I hope you know what I mean. Let me to you specific real once more. I want to pull or carry a certain frequency sampling rates for a sound under water. I don't want to use filters to make the sound. So can you please help me. I invited everyone locally on how to do it and nothing works. Also if this is not possible in the logic of tell me if there are third party plug ins or maybe even a different DAW that could do like komplete Kontrol or audacity.

    Effect under water

    See if this thread is helpful at all...

  • Synchronize book samples IBook?

    I can sync iBooks purchased on all my devices but iBook samples

    does not synchronize. It is built in iBooks property or a mistake on my part.

    Indicators are defined the same as those purchased books.

    The samples are not synchronized between devices

  • EXS24 sampler

    Hello

    I was wondering if I could use the sounds I downloaded logic pro x (like 30 gb of sounds) in the exs24 sampler...

    The problem is: when I go on the button 'Browse', I can't find any sound to drag on the sampler...

    Help, please!

    Try this... (hard drive) - Instruments/Library/Application Support/logic/Sampler /.

Maybe you are looking for