I have a little issue with my led strip. I used the tutorial for the assembly, and I connected the led strip to a raspberry pi 3 a+.
When I run my script more than once, some led flickers in random time with random color. Sometimes its stops at LED nr 8 (or any other) (I use a 25pieces led strip) and doesn't change.
I checked the cables 3 times, I measured them with multimeter, I have the right adapter and everything.
I'm a beginner in programming, so if you can help me a bit, I would be very grateful.
Here is my code:
- Code: Select all | TOGGLE FULL SIZE
import time
import random
import board
import adafruit_ws2801
i=0
odata = board.D5
oclock = board.D6
numleds = 25
bright = 1
leds = adafruit_ws2801.WS2801(
oclock, odata, numleds, brightness=bright, auto_write=False
)
leds[0]=0xff0000
leds.show()
time.sleep(0.2)
for i in range(24):
leds[i+1] = 0xff0000
my_color = leds[0] # Returns (255, 0, 0)
my_colors = leds[0:24] # Returns [(255, 0, 0), (0, 255, 0), (0, 0, 255)]
leds.show()
time.sleep(0.2)
leds.fill((0,0,0))
leds.show()
time.sleep(0.2)
leds.fill((0,0,0))
leds.show()