I have a ws2811 LED strip that I was powering using an arduino, but I want to do some more complicated things with it, and figured my old raspberry pi would be perfect. So I followed a tutorial online and got it working... sort of ( https://thepihut.com/blogs/raspberry-pi-tutorials/using-neopixels-with-the-raspberry-pi )
I have a simple python script that should loop though red green and blue every second, but when I run it, the code works fine (prints every second) but the strip seems to hang randomly, then start working again, or display half a color, just random glitches.
Im assuming it's something to do with the data out of the pi not being what the strip is expecting, Does anyone have any ideas on this?
import time
import board
import neopixel
pixel_pin = board.D18
num_pixels = 5
ORDER = neopixel.GRB
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.2, auto_write=False, pixel_order=ORDER)
print("Start")
pixels.fill((0,0,0))
pixels.show()
time.sleep(1)
print("loop")
while True:
print("red")
for i in range(0,5):
pixels[i] = (255,0,0)
pixels.show()
time.sleep(1)
print("green")
for i in range(0,5):
pixels[i] = (0,255,0)
pixels.show()
time.sleep(1)
print("blue")
for i in range(0,5):
pixels[i] = (0,0,255)
pixels.show()
time.sleep(1)