fastLED help - special reinforcements needed

Helloo all help if anyone can ?? i am making a strip been at it a few days now, love the fadetoblackby effect got it going and all ok but need to adjust its start and stop point then move on to another part of code, used Neo pixel also but just pulling my hair out trying to sort it.

need to have clear strip set of 6 white led move to a set pint with a tail and fade at the end.
set point to be statci diffrent colourdlights then wite trail to move on again to final set of red lights.

attached both codes one is fast led just test the other is the main game.
any help would be fantastic.
cheers
Rob

#include <FastLED.h>
#define NUM_LEDS 60
#define DATA_PIN 6 //How boring and obvious!
#define COLOR_ORDER GRB //Green (G), Red (R), Blue (B)
#define CHIPSET WS2812B
#define BRIGHTNESS 60
#define VOLTS 5
#define MAX_AMPS 500 //value in milliamps

//ENOUGH NONSENSE!

CRGB leds[NUM_LEDS];

void setup() {

FastLED.addLeds<CHIPSET,DATA_PIN,COLOR_ORDER>(leds,NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS,MAX_AMPS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show(); 

//JONNY FIVE IS ALIVE!!!!!!!!!!!!!!!!!!!!

}


void loop() {
  fadeToBlackBy(leds, NUM_LEDS, 4);      // Smaller value = longer tail
  int i = (millis()/40) % NUM_LEDS;      // How fast it goes.
  leds[i] = CRGB::White;
  FastLED.show();
}

code for neo pixel works just want the white line to be a trail not a static strip fill.


#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

#define LED_PIN    6

#define LED_COUNT 110

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2;  // the number of the pushbutton pin
const int ledPin = 13;    // the number of the LED pin

// variables will change:
int buttonState = 0;  // variable for reading the pushbutton status

void setup() {

  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAP
  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)

 delay(120);  
}


void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    strip.clear();

    strip.show(); 



//White to Orange stripe
  colorWipe(strip.Color(255,   255,   255), 50); // Red

//Orange stripe 
  colorWipe2(strip.Color(255,   102,   0), 50); // Red

//Orange Flash
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+100); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+100);
    
    strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+800); 

colorWipeblack1(strip.Color(  0, 0, 0), 10);

//White Strip to END
  colorWipe3(strip.Color(  255, 255,   255), 10); // Green

//RED Crash flash
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+1200); 

colorWipeblack2(strip.Color(  0, 0, 0), 10);
delay(+2000);

// Black clear the road !! END
  colorWipeblack3(strip.Color(  0, 0,   0), 10); // Green
  strip.fill(0x00000000, 40, 5);









  
  } else {
    strip.clear();

    strip.show(); 





///DEMO 1
  colorWipeDEMO(strip.Color(  255, 255, 255), 90); // White
  colorWipeDEMO2(strip.Color(  0, 190,   40), 10); // Green

strip.fill(0x0000BC26, 67, 7);
    strip.show();  
delay(+100); 
strip.fill(0x00000000, 67, 7);
    strip.show();  
delay(+100);

strip.fill(0x0000BC26, 67, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00000000, 67, 7);
    strip.show();  
delay(+100);
strip.fill(0x0000BC26, 67, 7);
    strip.show();  
delay(+2000); 


  colorWipeDEMO3(strip.Color(  0, 0,   0), 10); // Black






}
}

//White to Orange stripe
void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels() -77; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=40);                        //  Pause for a moment
                       
  }
}
//Orange stripe 
void colorWipe2(uint32_t color, int wait) {
  for(int i=33; i<strip.numPixels() -73; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=120);                        //  Pause for a moment
                       
  }
}

//Black 1 stripe
void colorWipeblack1(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels() -77; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=80);                        //  Pause for a moment
                       
  }
}

//White Strip to END
void colorWipe3(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -7; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=70);                        //  Pause for a moment
                       
  }
}

//Black 2 stripe
void colorWipeblack2(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -7; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}



void colorWipeblack3(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=120);                        //  Pause for a moment
                       
  }
}




















//Demo white
void colorWipeDEMO(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -43; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}
//Demo Green
void colorWipeDEMO2(uint32_t color, int wait) {
  for(int i=67; i<strip.numPixels() -36; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}

//Demo Blakc
void colorWipeDEMO3(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}

The first sketch works nicely.

The second sketch only gets this far...

... but it has so much inside (colors, fades, chases that are unused).

I made the first sketch do this...

if you load that code it will run now trying to get the white to be a few leds with a faded tail behind it, rather than a solid line.

Cheers in advance for any help

:slight_smile:.

i have attached the second part of code here ...

/*
  Button

  Turns on and off a light emitting diode(LED) connected to digital pin 13,
  when pressing a pushbutton attached to pin 2.

  The circuit:
  - LED attached from pin 13 to ground through 220 ohm resistor
  - pushbutton attached to pin 2 from +5V
  - 10K resistor attached to pin 2 from ground

  - Note: on most Arduinos there is already an LED on the board
    attached to pin 13.

  created 2005
  by DojoDave <http://www.0j0.org>
  modified 30 Aug 2011
  by Tom Igoe

  This example code is in the public domain.

  https://www.arduino.cc/en/Tutorial/BuiltInExamples/Button
*/
//tt

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

#define LED_PIN    6

#define LED_COUNT 110

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2;  // the number of the pushbutton pin
const int ledPin = 13;    // the number of the LED pin

// variables will change:
int buttonState = 0;  // variable for reading the pushbutton status

void setup() {

  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAP
  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)

 delay(120);  
}


void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    strip.clear();

    strip.show(); 



//White to Orange stripe
  colorWipe(strip.Color(255,   255,   255), 50); // Red

//Orange stripe 
  colorWipe2(strip.Color(255,   102,   0), 50); // Red

//Orange Flash
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+100); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+100);
    
    strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+800); 

colorWipeblack1(strip.Color(  0, 0, 0), 10);

//White Strip to END
  colorWipe3(strip.Color(  255, 255,   255), 10); // Green

//RED Crash flash
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+1200); 

colorWipeblack2(strip.Color(  0, 0, 0), 10);
delay(+2000);

// Black clear the road !! END
  colorWipeblack3(strip.Color(  0, 0,   0), 10); // Green
  strip.fill(0x00000000, 40, 5);









  
  } else {
    strip.clear();

    strip.show(); 





    strip.clear();

    strip.show(); 



//White to Orange stripe
  colorWipe(strip.Color(255,   255,   255), 50); // Red

//Orange stripe 
  colorWipe2(strip.Color(255,   102,   0), 50); // Red

//Orange Flash
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+100); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+100);
    
    strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+800); 

colorWipeblack1(strip.Color(  0, 0, 0), 10);

//White Strip to END
  colorWipe3(strip.Color(  255, 255,   255), 10); // Green

//RED Crash flash
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+1200); 

colorWipeblack2(strip.Color(  0, 0, 0), 10);
delay(+2000);

// Black clear the road !! END
  colorWipeblack3(strip.Color(  0, 0,   0), 10); // Green
  strip.fill(0x00000000, 40, 5);









}
}

//White to Orange stripe
void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels() -77; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=40);                        //  Pause for a moment
                       
  }
}
//Orange stripe 
void colorWipe2(uint32_t color, int wait) {
  for(int i=33; i<strip.numPixels() -73; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=120);                        //  Pause for a moment
                       
  }
}

//Black 1 stripe
void colorWipeblack1(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels() -77; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=80);                        //  Pause for a moment
                       
  }
}

//White Strip to END
void colorWipe3(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -7; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=70);                        //  Pause for a moment
                       
  }
}

//Black 2 stripe
void colorWipeblack2(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -7; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}



void colorWipeblack3(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=120);                        //  Pause for a moment
                       
  }
}




















//Demo white
void colorWipeDEMO(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -43; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}
//Demo Green
void colorWipeDEMO2(uint32_t color, int wait) {
  for(int i=67; i<strip.numPixels() -36; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}

//Demo Blakc
void colorWipeDEMO3(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}

I think if i can just alter the start and end point a few times of the fastLED code and get the orange and red sections to flash a few times ill be there.

Any idea how i can set a start led and end led position that is not the full lengh of the strip?

my micky mouse version ...
for(int i=40; i<strip.numPixels() -43; i++) { // For each pixel in strip...

i edit the "i=40" bit then the "-43;"

void colorWipeDEMO(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -43; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}

That is what sketch #1 is doing... are you trying to do something different?

yes thats correct if i could take the first code with the tail behind it and replace this code solid white tail you would have cracked it, but one code is neopixel and the other is fastLED,its my firs time coding as you can probably tell...

to add extra fun all activates on a button press but i think i am ok with that bit.
here is the main code ...

/*
  Button

  Turns on and off a light emitting diode(LED) connected to digital pin 13,
  when pressing a pushbutton attached to pin 2.

  The circuit:
  - LED attached from pin 13 to ground through 220 ohm resistor
  - pushbutton attached to pin 2 from +5V
  - 10K resistor attached to pin 2 from ground

  - Note: on most Arduinos there is already an LED on the board
    attached to pin 13.

  created 2005
  by DojoDave <http://www.0j0.org>
  modified 30 Aug 2011
  by Tom Igoe

  This example code is in the public domain.

  https://www.arduino.cc/en/Tutorial/BuiltInExamples/Button
*/
//tt

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

#define LED_PIN    6

#define LED_COUNT 110

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2;  // the number of the pushbutton pin
const int ledPin = 13;    // the number of the LED pin

// variables will change:
int buttonState = 0;  // variable for reading the pushbutton status

void setup() {

  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAP
  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)

 delay(120);  
}


void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    strip.clear();

    strip.show(); 



//White to Orange stripe
  colorWipe(strip.Color(255,   255,   255), 50); // Red

//Orange stripe 
  colorWipe2(strip.Color(255,   102,   0), 50); // Red

//Orange Flash
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+100); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+100);
    
    strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+800); 

colorWipeblack1(strip.Color(  0, 0, 0), 10);

//White Strip to END
  colorWipe3(strip.Color(  255, 255,   255), 10); // Green

//RED Crash flash
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+1200); 

colorWipeblack2(strip.Color(  0, 0, 0), 10);
delay(+2000);

// Black clear the road !! END
  colorWipeblack3(strip.Color(  0, 0,   0), 10); // Green
  strip.fill(0x00000000, 40, 5);









  
  } else {
    strip.clear();

    strip.show(); 





    strip.clear();

    strip.show(); 



//White to Orange stripe
  colorWipe(strip.Color(255,   255,   255), 50); // Red

//Orange stripe 
  colorWipe2(strip.Color(255,   102,   0), 50); // Red

//Orange Flash
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+100); 
strip.fill(0x00000000, 33, 7);
    strip.show();  
delay(+100);
    
    strip.fill(0x00FF6600, 33, 7);
    strip.show();  
delay(+800); 

colorWipeblack1(strip.Color(  0, 0, 0), 10);

//White Strip to END
  colorWipe3(strip.Color(  255, 255,   255), 10); // Green

//RED Crash flash
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+200); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+300); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00000000, 103, 7);
    strip.show();  
delay(+500); 
strip.fill(0x00FF0606, 103, 7);
    strip.show();  
delay(+1200); 

colorWipeblack2(strip.Color(  0, 0, 0), 10);
delay(+2000);

// Black clear the road !! END
  colorWipeblack3(strip.Color(  0, 0,   0), 10); // Green
  strip.fill(0x00000000, 40, 5);









}
}

//White to Orange stripe
void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels() -77; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=40);                        //  Pause for a moment
                       
  }
}
//Orange stripe 
void colorWipe2(uint32_t color, int wait) {
  for(int i=33; i<strip.numPixels() -73; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=120);                        //  Pause for a moment
                       
  }
}

//Black 1 stripe
void colorWipeblack1(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels() -77; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=80);                        //  Pause for a moment
                       
  }
}

//White Strip to END
void colorWipe3(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -7; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=70);                        //  Pause for a moment
                       
  }
}

//Black 2 stripe
void colorWipeblack2(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -7; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}



void colorWipeblack3(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=120);                        //  Pause for a moment
                       
  }
}




















//Demo white
void colorWipeDEMO(uint32_t color, int wait) {
  for(int i=40; i<strip.numPixels() -43; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}
//Demo Green
void colorWipeDEMO2(uint32_t color, int wait) {
  for(int i=67; i<strip.numPixels() -36; i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}

//Demo Blakc
void colorWipeDEMO3(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait=30);                        //  Pause for a moment
                       
  }
}

Okay. You want to use Neopixel?

FastLED already has the "fade to black" but you can make your own... something like this...

Move your 100% neopixel. The next neopiixel is 75%. The next 50%. The last 25%.

Color first Neopixel (at N+0) 100% color.
Move Neopixel + 1 (N + 1)
Color N 100%, color N-1@75%
Move Neopixel + 1 (N + 2)
Color N 100%, color n-1@75%, color n-2@50%
Move Neopixel + 1 (pixel 3)
Color N 100%, color n-1@75%, color n-2@50%, color n-3@25%, n-4 0%

I think Neopixel has colorwipe() but you can just use setPixelColor() in a loop of 5 to color 100%, 75%, 50%, 25%, 0%.

Cool thanks for that do i put all code that in void setup ?
how would it look?
I am complete novice i am amazed i got this far :slight_smile:

I got the "fade to black" working on on the fastLED is there a way to set its start and finish points that are not max "LED_count" ?

  fadeToBlackBy(leds, NUM_LEDS, 4);      // Smaller value = longer tail
  int i = (millis()/40) % NUM_LEDS;      // How fast it goes.
  leds[i] = CRGB::White;
  FastLED.show();
}

the fade part is not the problem, i need to be able to change the start and stop of the distance of the animation, for eg. the strip is 100 LEDs long, start at LED 25 do the animation of the led going to LED 60, then stop.

Pause then go start at LED 72 then the animation goes to LED 85 then stop.

Not sure if this is out of the fastLED and Neopixel capabilities.
Been looking about on forums for the past week trying to piece together the mess i have already lol

Thanks for your help it does mean a lot :slight_smile:
Rob

Even if i could get a row of 7 LEDs moving from a set point to another (black behind as it goes), does not need to have a fancy tail. i have found parts and demos of code to do this but cant figure it out to alter the start and stop points that are not full stip led count.

:worried:

found something like this...

for(int i=start; i<end; i++)

can something like that be used how would that look in the full code ?
time for more Coffee i think

Whoop !! got most of the way there just trying not to fade the orange part when the second white trail goes off.

Its not pretty and i know there is a lot of code to flash the pats but it gets the job done :slight_smile:

#include <FastLED.h>
#define NUM_LEDS 101
#define DATA_PIN 6 //How boring and obvious!
#define COLOR_ORDER GRB //Green (G), Red (R), Blue (B)
#define CHIPSET WS2812B
#define BRIGHTNESS 60
#define VOLTS 5
#define MAX_AMPS 500 //value in milliamps

//ENOUGH NONSENSE!

CRGB leds[NUM_LEDS];

void setup() {

FastLED.addLeds<CHIPSET,DATA_PIN,COLOR_ORDER>(leds,NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS,MAX_AMPS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show(); 

//JONNY FIVE IS ALIVE!!!!!!!!!!!!!!!!!!!!

}


void loop() {
{
Road1();
Road2();

int i=26; ///start of fill
  fill_solid( &(leds[i]), 7, CRGB( 0, 0, 0) );///End of fill and what colour
  FastLED.show();
delay(+200);
}
{

int i=26; ///start of fill
  fill_solid( &(leds[i]), 7, CRGB( 255, 100, 0) );///End of fill and what colour
  FastLED.show();
delay(+400);
}
{
int i=26; ///start of fill
  fill_solid( &(leds[i]), 7, CRGB( 0, 0, 0) );///End of fill and what colour
  FastLED.show();
delay(+400);
}
{
int i=26; ///start of fill
  fill_solid( &(leds[i]), 7, CRGB( 255, 100, 0) );///End of fill and what colour
  FastLED.show();
delay(+500);
}
{
int i=26; ///start of fill
  fill_solid( &(leds[i]), 7, CRGB( 0, 0, 0) );///End of fill and what colour
  FastLED.show();
delay(+400);
}
{

int i=26; ///start of fill
  fill_solid( &(leds[i]), 7, CRGB( 255, 100, 0) );///End of fill and what colour
  FastLED.show();
delay(+1000);
}
{



Road3();
Road4();
int i=93; ///start of fill
  fill_solid( &(leds[i]), 7, CRGB( 0, 0, 0) );///End of fill and what colour
  FastLED.show();
delay(+400);
}
{

int i=93; ///start of fill
  fill_solid( &(leds[i]), 7, CRGB( 60, 255, 0) );///End of fill and what colour
  FastLED.show();
delay(+1000);

Faderr ();

}
}

void Road1() {// Driving start
   for (int i=0; i<NUM_LEDS -75; i++) {
    fadeToBlackBy(leds, 50, 2); 
    leds[i] = CRGB(255,255,255);
    FastLED.show();
    delay(20); //even shorter delay this time
  } 

}
  


void Road2() {// Oragne Breaks on !!
   for (int i=26; i<NUM_LEDS -68; i++) {
    leds[i] = CRGB(255,100,0);
    FastLED.show();
    delay(100); //even shorter delay this time
  } 

}
 


void Road3() {// Breaking !! !!!!
   for (int i=33; i<NUM_LEDS -7; i++) {
    fadeToBlackBy(leds, 101, 20); 
    leds[i] = CRGB(255,255,255);
    FastLED.show();
    delay(25); //even shorter delay this time
  } 

}
  
  
void Road4() {// Green safe !!
   for (int i=93; i<NUM_LEDS -1; i++) {
    leds[i] = CRGB(60,255,0);
    FastLED.show();
    delay(100); //even shorter delay this time
  } 

}
 
void Faderr() {// Breaking !! !!!!
   for (int i=0; i<NUM_LEDS -28; i++) {
    fadeToBlackBy(leds, NUM_LEDS, 15); 
    leds[i] = CRGB(0,0,0);
    FastLED.show();
    delay(30); //even shorter delay this time
  } 

}

This is for running one time, to prepare for the rest of the sketch. void loop() is for repeating steps.

You can set the start and finish where you want. My "pseudo code" example had the main Neopixel as the letter N, each time through an inner loop, moving N forward. Once you light N, then you subtract one for N-1 neopixel and give that neopixel a less-bright value... repeat this for the neopixels your want in the tail. If you want 10 tails, you will go to N-10. If you want 3 tails, N-3.

All this is in Neopixel.

Start by lighting the ONE neopixel. Then see how to move from your start to your stop. Then try to fade one neopixel. Then fade a few.

You are using FastLED. Is that what you want? Your first sketch used FastLED, and it works.

Yes there seams to be a lot more help on the fastLED stuff so i moved the code over to that, the
"fadetoblackby" was the ticket.

Yes. FastLED has a lot of pre-written good stuff.

In their Github folder, they have many good examples:

This link is a complete list of FastLED functions:
http://fastled.io/docs/3.1/group___colorutils.html

And... here is a simulation showing FastLED showing a "fire" pattern

Adafruit_Neopixel.h has FadeToBlack...
void fadeToBlack(int rxx, int ledNo, byte fadeValue)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.