1

I'm new to Raspberry Pi and I have just figured out how to use Java to power LEDs. However, I cannot get GPIO 23 to work. This is my wiring setup.

My Wiring Setup

Here is the java code I am using to power the LEDs.

import java.io.IOException;
import javax.microedition.midlet.MIDlet;
import jdk.dio.DeviceManager;
import jdk.dio.gpio.GPIOPin;


public class LEDBlink extends MIDlet {
    public static final int GREENLED = 23;
    public static final int  REDLED = 24;
    public static final int YELLOWLED = 18;

    @Override
    public void startApp() {
        try {
            GPIOPin red = DeviceManager.open(REDLED);
            GPIOPin green = DeviceManager.open(GREENLED);
            GPIOPin yellow = DeviceManager.open(YELLOWLED);
            red.setValue(true);
            green.setValue(true);
            yellow.setValue(true);

        } catch (IOException ex) {

        }
    }
}

This code worked for GPIO 18 and 24 but not for 23.

My Wiring Setup

I double checked my wiring, replaced all wiring including LED and resistor. I also used the command line to try running the LED. None of that worked.

Does anyone know why I am having trouble?

  • Does the LED work if you move the other end of the lead from gpio23 to the 3V3+ rail? – joan Aug 13 '15 at 19:02
  • I removed the anode end of the LED and put it on 3V3+ and nothing happened. I then removed the wiring from GPIO 18 which worked just fine. I then exchanged the red and green LED and the green LED worked just fine off GPIO 24. I guess I'll have to do some more trouble shooting to figure out if it is my breadboard or my pi that has the issue. – jaydawg Aug 13 '15 at 19:34
0

I figured out that I had not connected the two halves of the breadboard as you can see on the left side. The resistor on the yellow LED was connected to one half of the breadboard, while the resistor connected to the green LED was on connected to the other half of the breadboard and was not hooked up to a ground.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.