Hello Everybody,
Anyone noticed that in the fast LED library the Red and Green are swapped?
Like that:
leds[i] = CRGB::Red; // is green
and
leds[i] = CRGB::Green; // is red
Mark
Hello Everybody,
Anyone noticed that in the fast LED library the Red and Green are swapped?
Like that:
leds[i] = CRGB::Red; // is green
and
leds[i] = CRGB::Green; // is red
Mark
Anyone noticed that in the fast LED library the Red and Green are swapped?
It is your LED strip, some have them swapped. Just compensate by defining the correct mode in the code.
Does this mean there are two kind of WS2812B ?
What I should change in this small minimal example?
#include "FastLED.h"
#define NUM_LEDS 5
#define DATA_PIN 10
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup()
{
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
}
void loop()
{
leds[0] = CRGB::Red; // shows green
leds[1] = CRGB::Green; // shows red
leds[2] = CRGB::Blue;
FastLED.show();
delay(500);
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
leds[2] = CRGB::Black;
FastLED.show();
delay(500);
}
Does this mean there are two kind of WS2812B
Yes. I have found the surface mount LEDs are RGB where as the individual packages, with wire ends are GRB.
What I should change in this small minimal example?
Change CRGB to CGRB and RGB>to GRB and if that doesn’t work then read the documentation for the library.
Hello Mike,
thank you. I have found it. Only the line in the setup method needs to be changed.
Here is the code:
#include "FastLED.h"
#define NUM_LEDS 5
#define DATA_PIN 10
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup()
{
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS); // for GRB LEDs
//FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // for RGB LEDs
}
void loop()
{
leds[0] = CRGB::Red; // shows green
leds[1] = CRGB::Green; // shows red
leds[2] = CRGB::Blue;
FastLED.show();
delay(500);
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
leds[2] = CRGB::Black;
FastLED.show();
delay(500);
}
I have used only WS2812B SMD LEDs.
Mark