Hi there, I have no experience with FastLED.

Hi there,
I have no experience with FastLED.
I am trying to blink with WS2812B (you can see the code below) and when LED is changing color to another color then I don’t know why but white color comes out :confused: pls take a look at the video.

I am using Arduino MiniPro 16MHz/5V

#include “FastLED.h”

#define NUM_LEDS 1
#define DATA_PIN 3

unsigned long lastChange = 0;
const long interval = 500;

void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
leds[0] = CRGB::Blue;
lastChange = millis();

void loop() {
unsigned long currentMillis = millis();
if (currentMillis - lastChange >= interval) {
lastChange = currentMillis;
int barva = random(0, 2);
if (barva == 0){
leds[0] = CRGB::Red;
if (barva == 1){
leds[0] = CRGB::Green;
if (barva == 2){
leds[0] = CRGB::Blue;

i don’t see the issue and can’t test the code but what i saw is the fact that the white comes every second assignement. It’s like every second time its running out of range and showing white… but this is just my observation… could also be missleading :wink:
try once FastLED.addLeds<WS2812,DATA_PIN>(leds, NUM_LEDS)

I have tested your update, but nothing has changed.

As you correctly observed, LED turns to white color any time when I want to change to another color. So when the led is green and has to change color to red ( or any other color) there is some intermediate step over white.


I have done some tests with setBrightness method. This method has no impact on the intermediate step(white color)

mhmm i can’t test the code because i’m missing the hardware right now.
Just as tip the fastled libary brings a macro for:
//do something every 500 ms

Do you power the led from the same source as the arduino?

So my last tipp would be simplify the code until it should work… try once:

void loop() {

leds[0] = CRGB::Red;

leds[0] = CRGB::Blue;

leds[0] = CRGB::Green;

and afterwards check if you still get whites… you don’t have any randoms inside so it makes easier to figure out what actually is the state…

Ah and the very last thing. You know about Serial.printLn(“some text”); ?

hi @Roman_MrAntonka_Fojt ,
I ran your code on my ws2812bs without seeing any flashing white during colour changes. The only thing i changed was the setup to match my rig.
Serveral suggestions:

  • check wiring and soldering (’+ tie LED & IC’s grounds together)
  • slip in a fastled.clear() call before swapping colours
  • make sure you have the right colour order in the setup (there’s a sketch in the example folder of the Fastled distribution to establish that)
  • put a cap across the LEDs’ pos and neg, + a smallish resistor on the data line. Costs (next-to) nothing, does no harm and might help (see: neopixel uberguide - best practises)

If all fails, you could also try using a different LED or a different pin on your Arduino (you never know, either could somehow be dodgy). If it still doesn’t work then I’m out of ideas because I’m also just dabbling.

other note:

  • the random function’s upper bound is exclusive. As it is in your code, the blue will never be called.

@Severin_N Yes I am using the same power supply for both devices.
and i have tryed your update but there is no change :confused: - I have tried a lot of different code from the internet but nothing works well. -> HW/wiring problem

thanks a lot for your help and time.

@matt_p hi :slight_smile: nice to hear.
grounds together - already done at the beginning.
FastLED.clear() - no effects
capacitors 1000uf - already done at the beginning.

OK, ALL FAILS :frowning:
I have to change the arduino to another one and LEDs too.


Have you tried to adress another led?
What di you mean with there is no change? Therw should be one. If there is absolutly no change i would say the upload failed…

Sorry but the wirering / soldering cant be that wrong after all. Otherwise it woulden’t light up at all…
There is a ws2811_400hz type… Probably that one?

Can you show me a video of the sketch i postedm

Are you sure about the led type you have?

@Severin_N yes I have tried one , two, three, … 64 leds - all leds does the same thing ( white stuff)

no change -> there is still white color.

I hope I am using a WS2812b. Guy who made the PCD and soldering told me. it is all what i know :frowning: do I(we) need to know anything more ?

yes I can make a video of your last update. give me some minutes


this is different LED like last time

Thanks… So it did change it behaviour but still you have the white in between… This is amazing… Sorry i don’t have any explonation for that behaviour… (But im new to that electrical stuff also do there are more experienced guys than me :wink: )

Can you do a video of your hardware /wirering.

Ah and a good idea is to set the brightness to lower… My leds startet to die while running them on full brightness. So http://fastlet.setbrightness(128) should do the job.

@Severin_N yee i know, but … when the LEDs starts do what i want, I am going to write better cpde :wink:

I will try another arduino and let you know :wink:

the setup seems to be fine, but whats that bellow the arduino?

i’m sure you tried a different pin right? just in case you didn’t :wink: