Fastled, WS2812 LED Strip Fade Colors 250722

Hello sblantipodi Grumpy Mike and the Arduino forum,

Got the XIAO SAMD21 to WS2812b circuit working.

Now looking at sketches for the RGB strip

Found

Fastled, WS2812 LED strip slowly transition through all colors.

  //EFFECT RAINBOW
  if (effectString == "rainbow") {
    // FastLED's built-in rainbow generator
    static uint8_t starthue = 0;    thishue++;
    //fill_rainbow(leds, NUM_LEDS, thishue, deltahue);
    fill_solid(leds, NUM_LEDS, CHSV(thishue,255,255));
    if (transitionTime == 0 or transitionTime == NULL) {
      transitionTime = 130;
    }
    showleds();
  }

Worked on getting this code snippet into a sketch that will compile.

//from
//https://arduino.stackexchange.com/questions/13136/fading-colors-on-a-ws2812-strip

#include <FastLED.h>
#define DATA_PIN 4
#define NUM_LEDS 197
#define effectString

#define COLOR_ORDER GRB

CRGB leds[NUM_LEDS];

void setup(){
  FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);

}

void loop(){

//EFFECT RAINBOW
    static uint8_t starthue = 0;    
    thishue++;
  if (effectString == "rainbow") {
    // FastLED's built-in rainbow generator
    fill_rainbow(leds, NUM_LEDS, thishue, deltahue);
    if (transitionTime == 0 or transitionTime == NULL) {
      transitionTime = 130;
    }
    showleds();
  }

}

This returns 'Compilation error "effectString" was not declared
So "effectString" was declared before void Setup()'
This returns 'Compilation error expected primary expression
before '==' token

Also tried the snippet that Grumpy Mike offered just below in post #9

//EFFECT RAINBOW
    static uint8_t starthue = 0;    
    thishue++;
  if (effectString == "rainbow") {
    // FastLED's built-in rainbow generator
    fill_rainbow(leds, NUM_LEDS, thishue, deltahue);
    if (transitionTime == 0 or transitionTime == NULL) {
      transitionTime = 130;
    }
    showleds();
  }

This returns similar: Compilation error thishue not
declared in this scope. Added this hue and the IDE
returns Compilation error expected primary expression
before ';' token

Any idea about how to get either or both of these
functions to compile?

Thanks.

Allen Pitts

Please post complete sketches and not snippets

Various libraries that support the ws2812 will have examples. Start with those and extract what you need.

Do you intend to abandon this thread as quickly as the last one, Mr. Pitts?

You never bothered to reply to anyone’s posts in that thread.

That is not a declaration.