How to stop a Progress/loading bar loop?

Hello there folks!

Another Beginner here, id like some help on how to stop a progress bar once it hits a certain length on an 16x2 LCD, by that i mean, how do i stop it from looping all the time.

Here is the link to the YT video tutorial i followed:

Here is the full code: (Using an Arduino Uno)

#include<LiquidCrystal.h>

LiquidCrystal lcd(1,2,4,5,6,7);
 byte p20[8] = {
   B10000,
   B10000,
   B10000,
   B10000,
   B10000,
   B10000,
   B10000,
   B10000,
  };
byte p40[8] = {
   B11000,
   B11000,
   B11000,
   B11000,
   B11000,
   B11000,
   B11000,
   B11000,
   };
 byte p60[8] = {
   B11100,
   B11100,
   B11100,
   B11100,
   B11100,
   B11100,
   B11100,
   B11100,
   };
 byte p80[8] = {
   B11110,
   B11110,
   B11110,
   B11110,
   B11110,
   B11110,
   B11110,
   B11110,
   };
 byte p100[8] = {
   B11111,
   B11111,
   B11111,
   B11111,
   B11111,
   B11111,
   B11111,
   B11111,
   };

void setup() {
  
  lcd.begin(16,2);
  lcd.setCursor(4,0);
  lcd.print("LOADING");

  lcd.createChar(0,p20);
  lcd.createChar(1,p40);
  lcd.createChar(2,p60);
  lcd.createChar(3,p80);
  lcd.createChar(4,p100);
}

void loop() {
  
  lcd.setCursor(0,1);
  lcd.print("                "); /*16 empty spaces */

  for(int i=0;i<16;++i)
   {
     for (int j=0;j<5;j++)
      {
      lcd.setCursor(i,1);
      lcd.write(j);
      delay(100);         
      }            
   }

}

And the infinite looping part:
i<16 being the “blocks” from the LCD, and j, the createChar arrays/ columns in 1 block

Ive tried messing around with some If statements and altering the For parameters so the bar would stop looping at the 16th “block”.

void loop() {
  
  lcd.setCursor(0,1);
  lcd.print("                "); /*16 empty spaces */

  for(int i=0;i<16;++i)
   {
     for (int j=0;j<5;j++)
      {
      lcd.setCursor(i,1);
      lcd.write(j);
      delay(100);         
      }            
   }

}

Thank you for your time!
Any help is greatly appreciated!

Quick 'n dirty would be to put the loop in a function and call that function on the condition that bool stopFlag is false;. When the loop completes set stopFlag true.

Or just stick the for loop in Setup.

crowdstar01:
Hello there folks!

Another Beginner here, id like some help on how to stop a progress bar once it hits a certain length on an 16x2 LCD, by that i mean, how do i stop it from looping all the time.

Here is the link to the YT video tutorial i followed:
Arduino Progress Bar Graph Tutorial - YouTube

Here is the full code: (Using an Arduino Uno)

#include<LiquidCrystal.h>

.
.
.
}




Thank you for your time!
Any help is greatly appreciated!

Karma++ for using code tags in Your first post!