# GPIO Output stopps on WS2812B

**URL:** <https://forum.core-electronics.com.au/t/gpio-output-stopps-on-ws2812b/16044>\
**Category:** Support\
**Created:** [4 January 2023 22:21 UTC](https://forum.core-electronics.com.au/t/gpio-output-stopps-on-ws2812b/16044 "2023-01-04T22:21:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin221026](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@Martin221026](https://forum.core-electronics.com.au/u/Martin221026)\
**Post date:** [4 January 2023 22:21 UTC](https://forum.core-electronics.com.au/t/gpio-output-stopps-on-ws2812b/16044/1 "2023-01-04T22:21:53Z")

</div>

Hello I’m new to this Forum.  
I was following the LED WS2812B Tutorial on this page: [How To Use Addressable RGB WS2812B LED Strips With a Raspberry Pi Single Board Computer - YouTube](https://www.youtube.com/watch?v=aNlaj1r7NKc&list=PLZJtzacm3pYMMu6Zifgq1vjNKOPyPM6LG&index=1)

Now i have the Problem that if I’m running a script with some commands for the LED after around 40 seconds the GPIO 18 Pin stops sending any signals and the LEDs just freeze in place.

I am relativly sure its not my code since I tryed different versions of it, the last one very simple just swiches between red and blue for all LEDs in a infinite loop and that freezes too.

I also dont think its the LEDs i bought since i measured the voltage on the GPIO pin itself and it just goes down to 0 after around 40 seconds.

And now im out of ideas.  
Please help.

Here my code if it helps:

```auto
#!/usr/bin/env python3

import time
from rpi_ws281x import *
import argparse

# LED strip configuration:
LED_COUNT = 60 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
#LED_PIN = 10 # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 10 # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 10 # Set to 0 for darkest and 255 for brightest
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53

# Main program logic follows:
if __name__ == ' __main__':
    # Process arguments
    parser = argparse.ArgumentParser()
    parser.add_argument('-c', '--clear', action='store_true', help='clear the display on exit')
    args = parser.parse_args()

    # Create NeoPixel object with appropriate configuration.
    strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
    # Intialize the library (must be called once before other functions).
    strip.begin()

    print ('Press Ctrl-C to quit.')
    if not args.clear:
        print('Use "-c" argument to clear LEDs on exit')

    try:
        while True:
            print("Cycle Again")

            for i in range(LED_COUNT-1):
                strip.setPixelColor(i, Color(255, 0, 0))
                strip.show()

            time.sleep(0.5)
            for i in range(LED_COUNT-1):
                strip.setPixelColor(i, Color(0, 255, 0))
                strip.show()
            time.sleep(0.5)

    except KeyboardInterrupt:
        print("exit")
        strip.setBrightness(0)
        strip.show() 

```

---

<div class="post-metadata">

**Author:** ![James](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/james/32/4400_2.png) [@James](https://forum.core-electronics.com.au/u/James)\
**Post date:** [9 January 2023 05:36 UTC](https://forum.core-electronics.com.au/t/gpio-output-stopps-on-ws2812b/16044/2 "2023-01-09T05:36:47Z")

</div>

Hi Martin,

Sorry we took a bit to get a bit to this one!

Are you able to share what you see on the terminal? Do you still get your `print` statements in that infinite loop? i.e. does the code freeze completely or do you just not see output?

I haven’t seen this issue before, but that might help narrow it down for us 🙂

---

<div class="post-metadata">

**Author:** ![Martin221026](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@Martin221026](https://forum.core-electronics.com.au/u/Martin221026)\
**Post date:** [11 January 2023 21:57 UTC](https://forum.core-electronics.com.au/t/gpio-output-stopps-on-ws2812b/16044/3 "2023-01-11T21:57:42Z")

</div>

Hi James,  
thanks for die answer. Yes the print statements still come trough and code seem to contiue running like nothing happend.  
Edit: it might also help to know if I stop the code after the LED froze in place I also get the last exit print but the Brightness doesn’t change to 0.

If I exit the code before the LED freeze the lights go out as intended.
