Since yesterday I been trying to figure out how to turn on a led on and off, my problem is that Pi4J (from what I can see) only takes up to 20 GPIO inputs and my breadboard is set to 30 and from a to l, I even tried to use only to the 20th spot on my breadboard.

I don't know if it matters, but the kit I bought with my Raspberry Pi is: http://www.amazon.com/gp/product/B00IEYI9WA/ref=oh_details_o00_s00_i01?ie=UTF8&psc=1

I know this question is probably trivial, but so far all the searches I have done failed.

1 Answer 1


PI4J is a Java software module to control some of the Pi's gpios. The Pi has 54 gpios of which some 17 are accessible via the Pi's P1 connector. PI4J refers to these accessible gpios as pin#0 to pin#16. See http://pi4j.com/example/control.html

You can switch those gpios on and off using PI4J.

You can connect one of the pins on P1 to a LED then resistor then ground (using something like a 330 ohm resistor in series to stop too much current flowing). This gives a complete electrical circuit. Switching the gpio on will light the LED.

For convenience you can use a breadboard to hold the LED and resistor and wires to the gpio and a Pi ground. It doesn't matter which breadboard letter you use, they are all equal. They act like an old fashioned plug switchboard.

See http://www.instructables.com/id/Breadboards-for-Beginners/

  • Ok, but how do I let the pi know to turn on lets say row 26?
    – Debels
    Apr 27, 2014 at 21:22
  • You don't. You tell the Pi to switch on a gpio. If you want that gpio to be used on row 26 of the breadboard you connect the gpio and that row with a wire.
    – joan
    Apr 27, 2014 at 21:51
  • I'm using a T Cobbler to connect both.
    – Debels
    Apr 27, 2014 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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