0

I would like to switch led over GPIO command. I follow this tutorial: https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/ and I have few problems. Here is my "construction":

Schema

  1. First problem is when I switch blue cable from GPIO4 to 3V3 then led almost doesn't light.
  2. According to tutorial shorter leg of led is minus, but in my case led lights only when connect shorter leg to 3V3 or GPIO4 pin. Is it possible?
  3. Last problem is that If I connect led to GPIO4 or GPIO17 it lights, and when I connect it to GPIO27 or GPIO22 it doesn't. Calling gpio write 0 0 (to turn off GPIO17) or gpio write 2 1 (to turn on GPIO27) causing no effect.
  • Re #2, look inside the LED. The side with the smaller plate is positive. – goldilocks Feb 8 '15 at 17:51
  • and just for fun every now and then manufactures will spit out some LEDs with the legs the wrong way around, cannot believe how long it took me to work that one out! – rob Feb 9 '15 at 9:14
  • Finally it looks like every start working after I disconnected the tape from raspberry pi and the board and turn it to the other side. – Sławomir Rosiek Feb 9 '15 at 20:58
2

Item #1, may be your resistor. if you know the forward voltage, and the power draw for the led, you can calculate the best resistor to use. Too high of a resistance will cause the LED to be dim, and too low will blow the LED, making it unusable. Also if the forward voltage is greater than 3.3v, you will want to use a transistor to put 5v through it. You can calculate the resistor you'll need for the LED here: http://ledcalc.com/

Item #2, Aside from whats noted above, if you look at the base of the LED, there is also one side flattened. This side is the negative, and should be connected to ground.

Item #3, What revesion do you have? The original pi doesn't have gpio27, instead it was gpio22. I've had no problem using all the pins for gpio using my model b, rev 2., but I use python's RPi.GPIO library....

I hope this helps :)

| improve this answer | |

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.