Colour wipe from centre out on digital LED strip

I have found code to do a centre wipe from the centre outwards. It’s working but with a couple of issues.

1)The strip turns on initially and I need it to be OFF at the start.

2)I set the strip colour to red but the strip is green?

This is a video of it working: https://youtu.be/jufrBAyGITI

I do need it to remain ON once it’s done the colour wipe.

How do I edit the code to get it to work how I want it to work?

I am a beginner with Ardunio.

Thanks!

#include <Adafruit_NeoPixel.h>


#define PIN D6


uint8_t NUMPIXELS = 14;      // total number of LED's in the strip

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);  // an instance for the LED strip

void setup() {
  // put your setup code here, to run once:
  strip.begin();
  strip.setBrightness(30); //adjust brightness here
  strip.show(); // Initialize all pixels to 'off'
}



void loop() {

  //Ascend strip
  for (int i = NUMPIXELS / 2; i >= 0; i--) {
    //for (int i = 0; i < (NUMPIXELS / 2) + 1; i++) {
    strip.setPixelColor(i, strip.Color(255, 0, 0));
    strip.setPixelColor(NUMPIXELS - i, strip.Color(255, 0, 0));
    strip.show();
    delay(200);
  }

  // Descend Strip
  for (int i = NUMPIXELS / 2 ; i >= 0; i--) {
    //for (int i = 0; i < (NUMPIXELS / 2) + 1; i++) {
    strip.setPixelColor(i, strip.Color(255, 0, 0));
    strip.setPixelColor(NUMPIXELS - i, strip.Color(255, 0, 0));
    strip.show();
    delay(200);
  }

}

for question 2, Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);  // an instance for the LED striptry changing NEO_RGB to NEO_GRB ledstrips come in all types, also using the same chip, the way it is connected to the led may differ per strip(type) the 3rd argument in the object declares the RGB sequence of the strip

1)The strip turns on initially and I need it to be OFF at the start.

what do you mean by that ?

Deva_Rishi:
for question 2, Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);  // an instance for the LED striptry changing NEO_RGB to NEO_GRB ledstrips come in all types, also using the same chip, the way it is connected to the led may differ per strip(type) the 3rd argument in the object declares the RGB sequence of the stripwhat do you mean by that ?

Thanks! I'll try the GRB option now. That would make sense. It's not specifically a neopixel strip so could well be that.

I mean that if you see the video, the strip lights up green when power is applied and then does the colour wipe and stays ON.

Is is possible to have the strip OFF on power up, do the colour wipe and then remain ON?

Thanks.

There is no real programmatic reason for the strip to light up 'green' at first, other than that maybe the strip was green before power-down. (some do tend to have a slight memory)

Is is possible to have the strip OFF on power up, do the colour wipe and then remain ON?

so technically speaking it is off on power-up. If you want it to do just one color wipe you have to move that part of the code from loop() to setup() where it only gets run once.

Thanks! Those are both now fixed. It's working as I hoped.