1

I am trying to get my LED to blink once, but it is not working. I connected the brown wire to pin 6 (Ground), and the red to pin 7 (GPIO 4). I watched a tutorial on connecting the circuit but it is not working for some reason.

Everything on the breadboard should be lined up perfectly. I am using a 220 ohm resistor. I am very new to this and it is the first circuit I ever tried, so I may be doing something wrong or I guess it’s a possible that the breadboard is bad but I find that to be unlikely.

Here is my code:

#blink.py
import time
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.output(4, True)
time.sleep(1)
GPIO.output(4, False)

Here is my circuit: bread board connection

  • You can test the breadboard by connecting the red wire to +3V3 (pin1) and make sure it lights up. – John La Rooy Feb 12 at 23:01
  • @JohnLaRooy ok good news: it was a faulty LED so I put one in that works. Except now when I connect it back to pin 7 it turns on automatically and stays on when I haven’t even run the program yet...is it possible the program is like running in background or something? Cause now when I click run nothing happens (LED stay lit) – Andy Lebowitz Feb 12 at 23:10
  • Have you got the 1-wire interface turned on? I believe BCM GPIO 4 is the default pin for this interface. – CoderMike Feb 12 at 23:35
  • @CoderMike I’m sorry I’m not sure what u mean. Can u clarify and also let me know how to check if I am on that interface? Thanks – Andy Lebowitz Feb 12 at 23:49
  • 2
    Please don't use pictures of text, instead paste the text direct into the question. – Ingo Feb 13 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.