No light with FastLED, WS2812B and Arduino in PlatformIO (but with ArduinoIDE)

Hi MCU experts. I am quite new in the Arduino and PlatformIO universe, and I am faced with a strange issue. I am trying to address a WS2812B LED strip on an Arduino Uno R3 using the FastLED library. There is no problem when I use the ArduinoIDE, but I get no light at all when I use the PlatformIO with Visual Studio Code.

Experimental setup:

  • tested with Arduino Uno R3 (original) and Arduino Nano v3 (clone)
  • VSC v1.63.2 (Win10)
  • PlatformIO v2.4.0 (Core 5.2.4 Home 3.4.0)
  • FastLED v3.5.0 (checked with some older versions as well)
  • example: FirstLight.ino with following changes
    #define NUM_LEDS 2
    #define DATA_PIN 6
    FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  • platformio.ini
platform = atmelavr
board = uno
framework = arduino
lib_deps = fastled/FastLED@^3.5.0

I checked the output with a logic analyzer. When I compiled with ArduinoIDE I get the expected result (#000000 #ffffff delay #ffffff #000000 etc). The timing of one triple byte (#000000) is 30µs.

Same sample compiled with PlatformIO results in no light. But with logic analyzer I see #000000 #000000 delay #000000 #000000 etc. The timing is a little bit different: 46µs for a triple byte (#000000). All bits are well-formed zero bits.

Where is my mistake? Or is this a bug? I can’t believe that I’m the first one using PlatformIO for Arduino with FastLED library. Thanks in advance.

Full sample code:

#include <FastLED.h>

#define NUM_LEDS 2
#define DATA_PIN 6


void setup() {
   FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);  // GRB ordering is typical

void loop() {
   for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
      leds[whiteLed] = CRGB::White;;
      leds[whiteLed] = CRGB::Black;
  • What version of the AVR boards does the Tools → Boards → Board manager menu show you have installed?
  • What version of the FastLED library does the Sketch → Include Library → Library Manager show you have installed?

In ArduinoIDE:
Arduino AVR Boards 1.8.3
FastLED 3.5.0

Try two variants of this:

platform = atmelavr@3.0.0


platform = atmelavr@3.4.0

Do they behave differently?

Same behavior (no light) with atmelavr@3.0.0 nor atmelavr@3.4.0 (not checked with logic analyzer yet).

Please open an issue at GitHub - platformio/platform-atmelavr: Atmel AVR: development platform for PlatformIO.

Or, as a last-ditch effort before that, try adding

lib_archive = no

to the platformio.ini and see if it changes anything.

No change when I add

lib_archive = no

Before I open a Github issue, I would like to be sure that this is a reproducible bug. From my current perspective it seems to be a problem with WS281x LED strips using the FastLED library on atmelavr platform. And this is a quite common setup.
Therefore, I am not sure if I have found a real bug or if it is just an incorrect operation/configuration from my side (as mentioned I’m new to PlatformIO and VSC). Maybe someone with this hardware could try to reproduce this issue and give me feedback. Thanks.

If you have the same hardware and sketch working in the Arduino but not PlatformIO and they are both supposed to use the same core version, you have sufficient grounds to assume a bug and thus an issue can be opened.

I opened an issue at github. Thank you for your support.

I am new to platformIO too, but do you need a

#include <Arduino.h>

statement at the top?


@cool_javelin I use FastLED (but with a SAMD21-based device). I do include FastLED itself as well as Arduino header in my code (and it works).