GRBW not recognized

Hi,

I am trying to get my addressable LED strip to work with my Uno and it is a 300 LED, GRBW strip (SK6812). I tried to change the strip type from GRB to GRBW, but it says ‘GRBW was not declared in this scope’. RGBW does not work either for that matter.

This is the code that includes my definitions, libraries and the void setup:

#include "FastLED.h"
#include <EEPROM.h>

#define NUM_LEDS 300

CRGB leds[NUM_LEDS];
#define PIN 5
#define BRIGHTNESS 255

#define BUTTON 2
byte selectedEffect=0;

void setup()
{
  FastLED.addLeds<SK6812, PIN, GRBW>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  pinMode(2,INPUT_PULLUP); // internal pull-up resistor
  attachInterrupt (digitalPinToInterrupt (BUTTON), changeEffect, CHANGE); // pressed
  digitalWrite(2, HIGH);       // turn on pullup resistors
  delay(100); // little 100ms delay before attaching the interrupt for the button
   
}

All my libraries are up to date and I am using IDE 1.8.13. I can’t find any examples of Arduino code with GRBW…any help here would be greatly appreciated. Thanks

Are you sure FastLED supports LED strips with dedicated White?

Not sure actually. I tried to find info about it, but couldn't.

Try including "Adafruit_NeoPixel.h"

-jim lee

Hm I tried that and it said ‘strip was not declared in this scope’ under the line strip.setPixelColor(Pixel, strip.Color(red, green, blue));

I’ve attached the .ino file to show where it gave the error.

FINAL_ALL_SKETCHES_pendant2.ino (12.2 KB)

You don't want to include the neo pixel library. If you do, it tries to use a variable called 'strip' but you have named your array of leds 'leds'

lakerice: Not sure actually. I tried to find info about it, but couldn't.

If you look at the declaration of the 'CRGB' structure in pixeltypes.h, you'll see that FastLED does not support LED strips with a dedicated White LED.

It looks like Adafruit's library does. You'll need to adapt your code accordingly.

So I finally figured it out. You’re right it wasn’t going to work with CRGB alone. It also wouldn’t work with SK6812 declared in the void setup. I used a hack modified by Dave Madison, which uses a file called FastLED_RGBW.h, which essentially tricks Fastled into thinking it is still working with a WS2812B strip but is actually a CRGBW struct. There are quite a few things to modify, so here is the link to the article and demonstrates in detail the changes you need to make as well as the explanation for the code.

This is the article FastLED with RGBW NeoPixels (SK6812) - Parts Not Included

I have also attached my updated .ino sketch, as well as the hack file. Keep in mind this is a tactile switch toggle button sketch, but you can modify it accordingly to your preference, or simply use the sample sketch in Dave’s article I linked.

Keep in mind there are some limitations, so not every feature of the Fastled library will work, but it does do a pretty good job.

I hope this helps, thanks again for all your help everyone!

FastLED_RGBW.h (1.06 KB)

sketch_sep20a.ino (11 KB)