Where to insert the break; line in my code?

Hello there everyone. So I’ve been working on a project involving lighting up WS2812Bs via Bluetooth.The project is somewhat working the way I want it to, but there is a problem. I can light my LEDs up then turn it off, but the code for turning it off is being looped forever, so I cannot turn on my LEDs again once I’ve turned it off. I would like to know where in my code I should enter the break function to make sure I can turn the LEDs on again after I’ve turned it off. The following would be my code.

#include <SoftwareSerial.h>
#include "FastLED.h"

SoftwareSerial BT(10, 11);

#define DATA_PIN    2    

#define NUM_LEDS 8
CRGB leds[NUM_LEDS];
bool off = false;
bool book1 = false;

void setup() { 
  BT.begin(9600);
    BT.println("Hello from Arduino");
  
  FastLED.show();
       FastLED.addLeds<WS2812B, DATA_PIN>(leds, NUM_LEDS);     
}
void loop()
{
  if(BT.available() > 0)
   {
      char c = BT.read();
      if(c == 'o')
         off = true;
   }

   if(off)
   {
      OFF();
   }
  
   if(BT.available() > 0)
   {
      char c = BT.read();
      if(c == '1')
         book1 = true;
   }

   if(book1)
   {
      Book1Indicator();
   }


void OFF() { 
      
  leds[NUM_LEDS] = CRGB(0,0,0);
  FastLED.show(); 
}

void Book1Indicator() { 
      
  leds[0] = CRGB(0,0,255);
  FastLED.show();
  delay(150);
  
  leds[7] = CRGB(255,255,255);
  FastLED.show();
  delay(150);
  
  leds[6] = CRGB(255,255,255);
  FastLED.show();
  delay(250);
  
  leds[5] = CRGB(255,255,255);
  FastLED.show();
  delay(150); 

  leds[4] = CRGB(255,255,255);
  FastLED.show();
  delay(150);

  leds[3] = CRGB(255,255,255);
  FastLED.show();
  delay(150);
  
  leds[2] = CRGB(255,255,255);
  FastLED.show();
  delay(150);
  
  leds[1] = CRGB(255,255,255);
  FastLED.show();
  delay(150); 
  
  FastLED.clear();
  delay(200);
}

}

It’d be really helpful if someone could point out where I should insert the break code or whatever additional or modified code in order to be able to turn on the LEDs again after turning them off. Finally, thank you to everyone to taking the time to read this and lend a hand.

What you need to do is read what you got from BT only once in the loop()

If you received something, then do a if/else or switch/case on what you have received to set a flag accordingly - you need to cover ALL the possibilities you want to support there because once you have read this data it is gone. then based on the flag, if it is a new command (you are changing stage - assuming you want to act only then) do what is appropriate and go wait again for a legit command to arrive

enum _states : byte {turnedOFF, book1, book2, book3, unknown} status;

void setup()
{
   ...
   status = turnedOFF;
   OFF(); // start with everything off
}

void loop()
{
  boolean newCommand = false;

  if(BT.available() > 0)  {
      _state newStatus = unknown;
      switch((char) BT.read()) {
          case ‘o’:
              newStatus = turnedOFF;
              break;

          case ‘1’:
              newStatus = book1;
              break;

          case ‘2’:
              .... // <— I let you finish
      }
      if (newStatus != unknown) {
            newCommand = (newStatus != status);
            status = newStatus;
       }
   } // end if BT available

    if (newCommand) {
       // we changed status handle it. 
       switch (status) {
           case turnedOFF:
              OFF();
               break;

            case ....  // <== I let you finish


       }
    } // end if new command 
} // end loop()

Just typed that on my tablet so might have some typos - for you to get the concept

      if(c == 'o')
         off = true;
   }

   if(off)
   {
      OFF();
   }

Once you’ve turned the strip off, does off still need to be true? What happens if you set off to false after turning the LEDs off?

If course, it will look silly having off false to mean that the LEDs should be off. A better name is DEFINITELY in order. Something like needToTurnStripOff is much better than off.