So I currently have 2x 12 Pixel Neopixel rings, running from a pi zero W.
The LEDs all work as expected, going through level shifter etc. and all react as expected.
Total noob with python but I can control the pixels and get them to do what I want, however I'm currently wanting to have each pixel on each ring randomly switch between 3 set colors at random times. Basically to have a flickering effect but only in that color range.
Currently I'm just changing each pixel manually in a function, that gets called from my script, that loops for a certain amount of time. It works ok but is a little inelegant.
def Lights_Flicker():
pixels[0] = (255, 0, 0,0)
pixels.show()
time.sleep(.02)
pixels[12] = (255, 0, 0,0)
pixels.show()
time.sleep(.02)
pixels[6] = (122, 100, 0,0)
pixels.show()
time.sleep(.02)
pixels[23] = (122, 100, 0,0)
pixels.show()
time.sleep(.02)
Using this to loop through the function for x seconds. (While Sound is playing)
while time.time() < t_end:
Lights_Flicker()
I'm happy with the timing portion its just the color flickering. If someone knows how to do this a little more cleanly that would be amazing.
Thanks for looking