I am new to Raspberry Pi 4 and I am trying to used an addressable WS2812B LED Strip with Python/NeoPixel to light objects from different angles for an AI project I am working on. I am able to address the LEDs fine with an array.
I would like to know if there is a function to clear the entire LED strip. I did a google search and see many references to "pixels.clear()" (Where pixels is the name of the LED STRIP in your program.) This appears to be a function available to Arduino programmers.
However, when I try to use "pixels.clear()" in my own Raspberry Pi/Python program, it throws an error:
AttributeError: 'NeoPixel' object has no attribute 'clear'
There is a function that FILLS all pixels with the color specified. If you fill all of the pixels with BLACK, it is the same as clearing the entire strip.
pixels.fill((0,0,0))
pixels.show()
I hope others find this useful.