Stuck in a loop - Help required

Dear team,
I’m trying to run this simple piece of code to make my neopixel ring breath, just once. However it seems to continually breath and I can’t seem to interrupt it. I can see the for loop but my understanding is that determines the brightness graduation unless i’m wrong. All suggestions welcome.

void loop() {
  glowblue();
  delay(5000);
}

void glowblue() {
  int TOTAL_LEDS = 24;
  float MaximumBrightness = 255;
  float SpeedFactor = 0.002; // I don't actually know what would look good
  float StepDelay = 5; // ms for a step delay on the lights

  // Make the lights breathe
  for (int i = 0; i < 65535; i++) {
    // Intensity will go from 10 - MaximumBrightness in a "breathing" manner
    float intensity = MaximumBrightness / 2.0 * (1.0 + SpeedFactor * i);
    strip.setBrightness(intensity);
    // Now set every LED to that color
    for (int ledNumber = 0; ledNumber < TOTAL_LEDS; ledNumber++) {
      strip.setPixelColor(ledNumber, 0, 0, 255);
    }

    strip.show();
    //Wait a bit before continuing to breathe
    delay(StepDelay);
  }
}

You have a stepdelay=5, a for loop that runs 65535 times and delays those 5ms evry time. That’s about 330s, after which you pause for 5 seconds, and start all over (not resetting the strip in the mean time, thus it stays on, appearing as though it never ends).

2 Likes