I am trying to make a LED blink on a Raspberry Pi Breadboard, but after everything I've tried, it doesn't work.

I have tried:

Changing wires and moving them around
Switching LED's to check if the current one is faulty (It's not)
Flipping the ribbon cable the other way (The original setup was correct, so I changed it back)
Following the manual provided by SunFounder ( I got my kit from SunFounder)
Copy pasting exact code from manuals
Following the exact layout from tutorials and pasting the exact code
Using different resistors to check if the current one was faulty (It wasn't, again)
Using different Jumper Cables
Using RPi.GPIO and gpiozero (made no difference- still didn't work.)
Flipping the LED around from positive and negative

Sources I've used:

Can't get my LED to flash

I used code from the links above.

import RPi.GPIO as GPIO
import time
pinNum = 8
GPIO.setmode(GPIO.BCM) #numbering scheme that corresponds to breakout board and pin layout
GPIO.setup(pinNum,GPIO.OUT) #replace pinNum with whatever pin you used, this sets up that pin as an output
#set LED to flash forever
while True:

and for gpiozero:

import gpiozero as gpio

led = gpio.LED(17)

while True:


import gpiozero as gpio

led = gpio.LED(11)

while True:

My first attempt looked like ( I tried powering the LED via 3.3v ) :

import gpiozero as gpio

led = gpio.LED(1)

while True:

I did the same for RPi.GPIO.

EDIT: I can't post wiring as I don't have a camera( I have a pc with no camera )

But, I do have the basic schematic I followed in the exact way Schematic

I'm still confused, though.

If the power is from the first 3.3V pin but the other wire is at GPIO17, should I use led = LED(1) or led = LED(17) or led = LED(11) ?

  • Post a photo of your wiring.
    – CoderMike
    Commented Oct 28, 2020 at 21:48
  • pinout.xyz/pinout/pin24_gpio8
    – Dougie
    Commented Oct 28, 2020 at 23:08
  • @CoderMike I don't have a camera, so I shared the schematic instead. I followed it exactly as shown
    – Raw Eggs
    Commented Oct 29, 2020 at 5:19
  • No phone or tablet with camera? The wire labeled '3v3 pin' in your diagram should be going to GPIO8 if you are using your first code example using 'RPi.GPIO'.
    – CoderMike
    Commented Oct 29, 2020 at 9:31

3 Answers 3


First of all, test the LED by connecting it to 3V3 and GND to make it come on without needing code. Then move from 3V3 to a GPIO pin and make sure you know which pin you're connected to. Refer to pinout.xyz.

Your gpiozero example is wrong. Running led.blink() in a loop is repeatedly starting the loop but never giving it chance to cycle. You can either create your own loop and turn it on and off repeatedly with a sleep in between; or just run blink on its own.

The only thing you need to think about is how you are running the code. If you're running it in an IDE that drops you in a shell after (IDLE, My, Thonny) then that's fine. If you're running it from the terminal, the script will terminate immediately because blink is not blocking. So you need to use signal.pause() to keep it running:

from gpiozero import LED
from signal import pause

led = LED(17)



If you want to add some debugging to see what's going on:

from gpiozero import LED, Device
from time import sleep

led = LED(17)



while True:
  • Okay, here is what i did after reading this comment: I added pause() after importing it, nothing changed, I changed the wiring around, again, nothing changed...
    – Raw Eggs
    Commented Oct 29, 2020 at 4:31
  • I also made sure that it was on the correct pin
    – Raw Eggs
    Commented Oct 29, 2020 at 4:33
  • I've added some debugging steps you can try. It should print something like <RPiGPIOFactory...>. If it's printing 1s and 0s in a cycle then it's working correctly. If the LED is still not lightning, then it's the wiring or components. Have you tested the LED without code by connecting it to 3V3 and GND? Commented Oct 29, 2020 at 10:16
  • i tried connecting it without code, seems to be a Grounding issue. It only activates while im touching it
    – Raw Eggs
    Commented Oct 29, 2020 at 10:22
  • Make sure you always have a resistor in series with the LED (otherwise it will burn out in microseconds).
    – joan
    Commented Oct 29, 2020 at 21:01

I would go with the RPi.GPIO on the Raspi. Which Version of Raspberry Pi you have? Two things that came up to my mind by reading your post were:

  • Have you checked that the LED is working? Connect it with a Resistor which fits your led. If Resistor is to high the LED maybe flashing not very bright. Have you checked that you use the LED in the proper way (not back-biased) ?

  • if UART is enabled on your Pi and you are using Pi 3B+ or the Pi 4 you may wont be able to use the Pin 8. try another Pin or disable UART

  • use a mulimeter to measure the voltage when you turn output of pin HIGH and LOW (if not changeing between 3,3V and 0V you may use the wrong pin.

  • check for pinnumber in google with searching raspberry pi pinout (and your pi model)

In your code with the RPi.GPIO you set the output of the GPIO with: GPIO.setmode(GPIO.BCM). You should check that you use the right Pinnumber with the right Pin. maybe you refer to the pinnumber from BOARD ( GPIO.setmode(GPIO.BOARD)). always be careful. (Pinnnumber from BCM 14 is the same as BOARD 8. Pinnumber from BCM 8 is the same as BOARD 24.


my Grounding Pin was faulty, it only worked when i touched it, sorry for making you guys put your useful help here :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.