Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
blue66moon opened this issue Jan 18, 2022 · 0 comments

Comments

@blue66moon
Copy link

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
[env:uno]
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 (0x000000 0xffffff delay 0xffffff 0x000000 etc). The timing of one triple byte (0x000000) is 30µs.

Same sample compiled with PlatformIO results in no light. But with logic analyzer I see 0x000000 0x000000 delay 0x000000 0x000000 etc. The timing is a little bit different: 46µs for a triple byte (0x000000). 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.

This issue was posted first at platformio.org: https://community.platformio.org/t/no-light-with-fastled-ws2812b-and-arduino-in-platformio-but-with-arduinoide/25508/7

Full sample code:

#include <FastLED.h>

#define NUM_LEDS 2
#define DATA_PIN 6

CRGB leds[NUM_LEDS];

void setup() {
   delay(2000);
   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;
      FastLED.show(100);
      delay(100);
      leds[whiteLed] = CRGB::Black;
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant