ws2812-spi icon indicating copy to clipboard operation
ws2812-spi copied to clipboard

Lib didn't work, although where was no errors.

Open Ilex4524 opened this issue 6 years ago • 2 comments

I faced a problem when I was trying to use your library. I try code below where each of 30 leds has 255;255;255 color, but it didn't work, although where was no errors.

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
port = 10
GPIO.setup(port,GPIO.OUT)
level = False
for i in range(0, 720):
        GPIO.output(port, 1)
        GPIO.output(port, 0)

Ilex4524 avatar May 31 '18 18:05 Ilex4524

The code you showed doesn't use the ws2812-spi library. Why do you think the error is in the ws2812 library?

Also, when including multi-line code fragments, you need to start and end the segments with three backticks (```, started on an empty line), not just one (that's for single line fragments)

import RPi.GPIO as GPIO
import time GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
port = 10 GPIO.setup(port,GPIO.OUT)
level = False
for i in range(0, 720):
  GPIO.output(port, 1)
GPIO.output(port, 0)

joosteto avatar Jun 01 '18 13:06 joosteto

Thank you for an answer! Sorry, that's not what I meant. I was trying to explain what I used the code mentioned above and it worked fine, making all 30 diodes light up with white color. I pointed this out just to show what I wired up led string properly. But then I try to use your library as proposed here with the sample program:

import spidev
import ws2812
spi = spidev.SpiDev()
spi.open(0,0)

#write 4 WS2812's, with the following colors: red, green, blue, yellow
ws2812.write2812(spi, [[10,0,0], [0,10,0], [0,0,10], [10, 10, 0]])

Actually it did nothing but also there wasn't any errors outputted. I would be very grateful if you'd suggest what I'm doing wrong.

Ilex4524 avatar Jun 01 '18 16:06 Ilex4524