I'm wondering if it's possible to use the pi pins directly to toggle a led programmatically.

I don't have a GPIO board. Is it possible to connect the led to the pins and control it from the code?


Yes, You can connect LEDs directly to Pi's pins. The Pi has many GPIOs on the header and you can use any one of them and connect an LED on a breadboard.

Here is one very well explained tutorial for the same:- Click Here

Here is reference image about LED Connection.

enter image description here

| improve this answer | |
  • The problem is that I don't have a breadboard. Let's assume I only have the Raspberry Pi accessible via wifi and an LED. Is it possible to turn on/off the LED this way? – Ionică Bizău Aug 4 '16 at 4:19
  • Which Raspberry Pi model you have? Without connecting LED how can you turn ON LED? – HallMark Aug 4 '16 at 4:42
  • I have a Raspberry PI 2 B+. I don't have that kind of board with many holes in it, but I would like to use the pins from Raspberry Pi directly. Isn't that possible? How can I connect the LED to them? – Ionică Bizău Aug 4 '16 at 4:49
  • That board helps you to avoid any false short circuit when connecting and if you really not want to use that one then get wires and connect same connection manually without board. – HallMark Aug 4 '16 at 4:57
  • I have updated answer with LED Connection image you can connect something like that. – HallMark Aug 4 '16 at 5:02

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.