4

I'm quite new to the Raspberry world, and I cannot figure out what's not working on my tiny test project on my B+.

I connected a red LED to the 3v3 (pin#1) and a resistor to the ground (pin#6), and the light is on.

Then I turn a GPIO on with this command (I use WiringPi) :

gpio mode 0 out
gpio write 0 1
gpio read 0 //returns 1

But if I connect a yellow LED to the GPIO 0(pin#11) and a resistor to the ground (pin#6), the light is off.

I tried also with others GPIO and no success either.

Raspberry Pi Fritzing

What am I doing wrong?

  • Can we see a pic or two of your wiring? Also, if the above is only part of the code can we see it all? If doing the above in a file (and not at the command line) please include the command you are using to run it. Please add these by editing your question and not by adding them to the comments. To rule out the most common have you tried reversing the LED? – Steve Robillard Dec 28 '15 at 15:25
  • What's the value of resistor ? – dhruvvyas90 Dec 28 '15 at 16:09
  • 1
    Did you make sure that the logic pin is connected to the high-side terminal of the diode (usually the longer lead)? Diodes only operate in one direction so if it's backwards it won't light. Value of the resistor may make a difference as well - if the yellow LED has a higher forward-operating voltage than the red one you're using then you may get a dimmer output using even the same resistor value. Try using the same red led configuration you put on the 3v pin on the logic pin and you should get the same result if the pin is on. – T3am5hark Dec 28 '15 at 18:00
  • OP here : resistors are 330 ohms and I tried with both side of LEDS. I made a little image of my wiring (but due to bug, it has to be peer reviewed). The red led was actually on a test purpose so everything is the same. – Dan Chaltiel Dec 29 '15 at 11:14
  • Try moving the yellow wire one pin to the left. Based on the image of your circuit you are using wiring pi pin2 but your code is referencing pin0. If you prefer you can change the pin number in your code from 0 to 2. – Steve Robillard Dec 29 '15 at 12:37
1

Following by this image: IMAGE and this IMAGE Connect your led to GPIO26 and issue one of the following:

gpio -g mode 26 out
gpio -g write 26 1

-g will use BCM_GPIO numbering scheme

gpio -1 mode 37 out
gpio -1 write 37 1

-1 will use physical pin numbering scheme

gpio mode 25 out
gpio  write 25 1

wiringPi pin numbering scheme

0

In that picture, the yellow is connected to GPIO27 and pin 13...

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.