WS2812 LEDs look like they're running and chasing along a strip

I want to have a few LEDs running around the strip in a chasing pattern, so I found this bit of code which works well, but needs to be modified for my needs. I figured out that the i-2 part is the number of LEDs that are lit up and travel together around the strip, lighting up 2 and making it look like it snakes along the strip. I want to do more than 2 lit up together at one time, but when I changed i to i-5 or 10, that number of LEDs light up, but the speed greatly decreases and it crawls. How do I change the number of LEDs that are doing this pattern from 2 but be able to change or keep the quicker pace. Changing the delay number for the current i-2 does change the speed, but changing the 2 to any higher value makes the speed of the pattern drop significantly. Here is the bit of code:

for(int i=0;i<NUM_LEDS;i++){
leds[i-2].setRGB(0,0,0);
leds*.setRGB(255,255,0);*

  • FastLED.show();*
  • delay(50);*

Does you code really look like that ?
Did you read this before posting a programming question

You are writing outside the array.

 for(int i=0; i<NUM_LEDS; i++){ 
   leds[i-2].setRGB(0,0,0);

UKHeliBob:
Does you code really look like that ?
Did you read this before posting a programming question
[/quo

technically it does, but its one function and LED pattern in a multi pattern LED dance of sorts.

technically it does, but its one function and LED pattern in a multi pattern LED dance of sorts.

Check this line from your post carefully

leds.setRGB(255,255,0);

I am willing to bet that line of code does not appear in the program in the IDE