0

idk if this is happening because its a niche use-case, but I have a project where I'm trying to initialize a "strip" of only two ws2812b LEDs and make them blink red and green. I've been following this guide to do so: https://core-electronics.com.au/guides/raspberry-pi/fully-addressable-rgb-raspberry-pi/

The reason I'm only driving two at a time is because they are going to be attached to some model planes (one on each wing) for a display I'm working on and I want to control each plane individually. That and due to the layout, I can't have wires running across the entire thing like a messed up spider web of wires (which would look tacky), so its simpler to do it this way.

I've wired up the LED's, and hooked them up to the pi. I got them to come on, but the problem I'm having is that whenever I try to control the LEDs, they behave unpredictably, and I'm unable to get the colors I want to appear. Instead when I run the script, the LEDs stay dark for between 30-45 seconds (the timing is different each run), then they each appear as a random color. On one execution, they appeared orange/blue, another magenta/yellow, there was even one time only one LED came on at a time, so I have no clue what's happening here.

For context, a friend of mine was working on this project before me a few years back, and he made some progress, but then the project got dropped, and now I'm picking up where he left off.

I know that my code isn't the issue, because I got the same code to work once before on an older system, but after updating python on my pi (from python2, it was an older version of Raspbian and presumably the library too) everything broke and I've been unable to revert back. Now that older system can't even see the Neopixel module if i try to run my script.

Since then, I've flashed another SD card with a fresh install of the latest version of Raspbian (twice) and followed the linked guide to the letter, but now I'm back to getting that random behavior again. I've also tried installing the same packages on the same version of Raspbian that I got it to work with before, but PIP keeps throwing syntax errors when I try to install the package, when it just worked on the newer OS (presumably due to later versions of the library no longer being compatible with the older OS, and idk what versions of what were used before)

Now I'm starting to rub against my deadline for this project and I've exhausted the solutions I can think of on my own. Can I please get some assistance with this issue?

This is the code I'm using:

import neopixel
from time import sleep
import board

strip = neopixel.NeoPixel(board.D18, 2)

while True:
            strip[0] = (0, 204, 0)
            strip[1] = (204, 0, 0)

            sleep(.1)

            strip[0] = (0, 0, 0)
            strip[1] = (0, 0, 0)

            sleep(1)

Side note: Eventually I want to be able to drive a fleet of these 2-LED pairs individually for stuff like audio visualization, but I can't even get a single pair to work properly anymore, not to mention how the library won't let me initialize more than one plane at a time from a single process (that's gonna get its own question though)

ShadowGamer3
  • 49
  • 2
  • 11

0 Answers0