1

I've been following basic tutorials on how to programmatically turn on leds from my Raspberry Pi 2. I'm using a breadboard, and I connect 3 leds, using a male-female jumper from the pins of the raspberry to the breadboard. I've been using the pins 7, 11 and 13 (GPIO 4, GPIO 17 and GPIO 27). Yesterday I got everything working as expected, code used is (shortened):

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.output(17,True)
GPIO.cleanup()

Today I've been making some changes, and at the end wanted to return the same old configuration. Did everything as the tutorials said again, but now the led connected to pin 11 (GPIO17) is always on, doesn't matter the programmatical input.

Any ideas where I probably go wrong, or maybe some settings I need to change. Any ideas will be appreciated.

  • For a test : are you able to test a different pin - and see if the same thing happens ? – monojohnny Mar 11 '15 at 12:39
  • I've tested pins GPIO 27 and GPIO 22 and everything works as expected. Same problem occurs on pins GPIO 2 and GPIO 3 – Stefan Doychev Mar 11 '15 at 12:59
  • gpios 2 and 3 have fixed 1k8 pull-ups to 3V3 and will always read back as 1 unless they are driven low. They may be used as I2C (which needs the pull-ups). What is connected to pin 11? Are you sure it's not connected to 3V3 rather than ground? – joan Mar 11 '15 at 14:27
  • I have a jumper cable connected to pin 11, going to the breadboad, where is a led connected. After that a resistor and a another jumper cable going to Ground (pin 6). – Stefan Doychev Mar 11 '15 at 14:30
  • The code you show only switches the gpio high (True or 1). Could you confirm that it doesn't work when you switch the gpio low (False or 0)? – joan Mar 11 '15 at 16:07
1

I had the same issue using an LED bar (8 LEDs with common VCC). I was setting the pins I wanted to turn on LOW. Six of the eight were faintly ON even when they were set to HIGH (ungrounded). I found that switching their power from 5v to 3.3v fixed everything (even though they are rated for both).I'm not electrical so I'll leave it someone else to explain.

LED Bar

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.