Hello there! I’m new to the world of Arduino & FastLED and I’m

Hello there!
I’m new to the world of Arduino & FastLED and I’m looking to get some help on how the achieve the following. I’m using WS2812B LED strip and I want to fill the strip with a defined colour one LED at a time. I want to leave each LED ON until I get to the end. I then want to reverse the routine so they each turn off in one by one. I was looking to somehow modify the FastLED FirstLight code but would I be better off starting from scratch?
Thanks for any help

What have you tried so far? I bet modifying existing code is a simple way to start.

Hi Mark, My coding knowledge is pretty non existent so my efforts are through trial & error. I’ve tried to modify the FirstLight code to make the LEDs run back again. But I’m getting function definition errors. I know there are problems with this but this is what I’ve done so far.

// How many leds are in the strip?
#define NUM_LEDS 10

// Data pin that led data will be written out over
#define DATA_PIN 3

// Clock pin only needed for SPI based chipsets when not using hardware SPI
//#define CLOCK_PIN 8

// This is an array of leds. One item for each led in your strip.
CRGB leds[NUM_LEDS];

// This function sets up the ledsand tells the controller about them
void setup() {
// sanity check delay - allows reprogramming if accidently blowing power w/leds
delay(2000);

   FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);

}

// This function runs over and over, and is where you do the magic to light
// your leds.
void loop() {
// Move a single white led
for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1)

{
// Turn our current led on to white, then show the leds
leds[whiteLed] = CRGB::White;

  // Show the leds (only one of which is set to white, from above)
  FastLED.show();

  // Wait a little bit
  delay(100);

  // Turn our current led back to black for the next loop around
  //leds[whiteLed] = CRGB::Black;

}

// Move a single white led
for(int whiteLed = 10; whiteLed > NUM_LEDS; whiteLed = whiteLed - 1)

// Turn our current led on to white, then show the leds
leds[whiteLed] = CRGB::White;

  // Show the leds (only one of which is set to white, from above)
  FastLED.show();

  // Wait a little bit
  delay(100);

  // Turn our current led back to black for the next loop around
  //leds[whiteLed] = CRGB::Black;

{

Thanks for any advice you can give, even if it is ‘give up’

Chris

Here is an excellent and easy to understand tutorial. You will decrement the counter to reverse the direction of the LEDs once they are at the end of the line. https://github.com/FastLED/FastLED/wiki/Basic-usage

@Chris_Wood , what you want to do sounds similar to someone’s question last week. Have a look here for further ideas and inspiration.
https://plus.google.com/117582757569926034252/posts/4NUM6yeQd1d

Thanks Guys I’m up and running with this now. Appreciate your help.