Void Loop Exit

Hello, I m new t the forum.

I had a program, LED to blink for 1 minute and then display hello world.

how do i exit Void Loop ???

code is here

int outPin = 8; // digital pin 8
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
pinMode(outPin, OUTPUT); // sets the digital pin as output
}

void loop() {
digitalWrite(outPin, HIGH); // sets the pin on
delay(1000); // pauses for 1 second
digitalWrite(outPin, LOW); // sets the pin off
delay(1000); // pauses for 1 second
}

You exit the loop() function every time the program counter reaches the closing bracket at the end of the function. Then loop() is called again, repeat over and over. So I think what you're really asking is how you can stop loop() from running. You can do this by executing an endless while() loop:

while(true) {}

You don't exit the loop() function.

Use a variable that keeps track of what needs to be done. Call it e.g. currentState.

byte currentState = 0;

void setup()
{
}

void loop()
{
  if (currentState == 0)
  {
    //do your blinking here
    //once blinking done
    currentState = 1;
  }
  else if (currentState == 1)
  {
    //display message
    //once message is displayed
    currentState = 2;
  }
}

This is called a finite state machine; you can read up on it.

Once currentState reaches 2, loop() has nothing to do so it looks like you exited loop().

}