Same code runs different on two different picos

import machine
import time
import math
import plasma
import random
from plasma import plasma2040
from pimoroni import RGBLED, Analog

led_strip = plasma.WS2812 (1000, 0, 0, 0)
led_strip.start()

for i in range(0,720,2):
    led_strip.set_rgb(i, 0,255,0)
print("ye2")

I’m running this code on two different pi picos. On one, it runs correctly. On the other, it sets all the LEDs to white. Any ideas about what might be happening?

Thanks.

I have to ask the obvious. ;)
Both flashed with the same UF2 file?
And do both have the same LED strip attached?

EDIT: I’m not sure if this affects the Plasma 2040 but on my Plasma Stick I have to edit the RGB to GRB

led_strip = plasma.WS2812(GRB_LEDS, 0, 0, plasma_stick.DAT, color_order=plasma.COLOR_ORDER_GRB)

It works now.

Screenshot 2024-03-18 at 20.40.25

1 Like

I hate it when that happens, lol. =)

Yeah, really knocks your confidence. I ate some toast and I think that fixed it???

1 Like

Did you maybe power cycle it / reset it, versus stop run?

Just be aware that you are dealing with hardware. And especially these ws2812 are tricky. If they don’t synchronize, you will have random colors. There are many reasons why this can happen.

Yeah, it was definitely unexpected behaviour and I thought I’d run into all the potential issues already. I’m pretty sure this was software related in the end as it was only when I ran the code that they went all white. But I don’t know what it was to be honest.