NeoPixel only working on GPIO18
See original GitHub issueHi, I’m developing an application using a Raspberry Pi CM4 in which I need to use a 12 led RGB WS2812B ring, and more specifically I have to create an animation where all of the 12 leds fade from minimum brightness to max and vice versa. I noticed that if I control the leds using GPIO18 it works fine, but if I try using a different pin, like GPIO10 or GPIO21, it has strange behaviours. For instance, all the leds become white and even if I send a different colour they keep staying white, or if I dimmer them from min to max, while the transition, different leds blink with different colours, completely at a random.
Here’s reported a snippet from the code I’m using.
import time
import board
import neopixel
pixel_pin = board.D21
num_pixels = 12
ORDER = neopixel.GRB
pixels = neopixel.NeoPixel(
pixel_pin, num_pixels, brightness=0.2, auto_write=False, pixel_order=ORDER
)
try:
while True:
for i in range(1, 255):
pixels.fill((i, 0, 0))
pixels.show()
time.sleep(0.005)
for i in range(254, 2, -1):
pixels.fill((i, 0, 0))
pixels.show()
time.sleep(0.005)
except KeyboardInterrupt:
print('Keyboard interrupt')
pixels.fill(0)
pixels.show()
pixels.deinit()
As said before, during the transition I’m actually facing leds changing colours and blinking completely at a random. This happens only if I use a GPIO that is not GPIO18. If I use GPIO18 for controlling the led ring everything works fine. I even tested the same code with two different OS (Raspberry OS and Manjaro ARM) but I have more or less the same behaviour.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
I think when I was looking into a similar issue a while back, this is the conclusion I came to as well. It’s not shareable and they’re essentially quantum entangled and modifying one modifies the other.
Closing because this is really a hardware limitation and nothing to do here.