break; not working in while(1) loop

Hi guys

Firstly, thanks a million for all your posts. If it wasn't for these forums I probably wouldn't have come as far as i did.
Now for the problem. I have a piece of code which runs a menu and from a selection in the menu it is supposed to start a while(1) loop, however when I put in a break; based on a push button, the while(1) loop no longer read my quadrature encoder. Below is my code and the part that causes the error is on line 400. (I know there is a lot of comments and crap in the code, but being a noob it helps with remembering)

#include <Wire.h>
#include <SoftwareSerial.h>
#include <Encoder.h>
//LCD Files
#include <LCD.h>
/*
IMPORTANT: to use the menubackend library by Alexander Brevig download it at http://www.arduino.cc/playground/uploads/Profiles/MenuBackend_1-4.zip and add the next code at line 195
    void toRoot() {
        setCurrent( &getRoot() );
    }
*/
#include <MenuBackend.h>    //MenuBackend library - copyright by Alexander Brevig
#include <LiquidCrystal_I2C.h>
const int buttonPinLeft = 9;      // pin for the Up button
const int buttonPinRight = 10;    // pin for the Down button
const int buttonPinEsc = 11;     // pin for the Esc button
const int buttonPinEnter = 8;   // pin for the Enter button
int IncDec = 0;    //variable for ++ and -- 
int lastButtonPushed = 0;
int lastButtonEnterState = LOW;   // the previous reading from the Enter input pin
int lastButtonEscState = LOW;   // the previous reading from the Esc input pin
int lastButtonLeftState = LOW;   // the previous reading from the Left input pin
int lastButtonRightState = LOW;   // the previous reading from the Right input pin
long lastEnterDebounceTime = 0;  // the last time the output pin was toggled
long lastEscDebounceTime = 0;  // the last time the output pin was toggled
long lastLeftDebounceTime = 0;  // the last time the output pin was toggled
long lastRightDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 250;    // the debounce time
int Counter = 0; //counter to display incrementing or decrementing values

#define rxPin 0
#define txPin 1

#define I2C_ADDR    0x27  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7
int n = 1;
const double WheelCirc = 500;
const double Pulses = 1000;
double Valv;
String toP;
LiquidCrystal_I2C       lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); // set the LCD address to 0x27 for a 16 chars and 2 line display
//Menu variables

SoftwareSerial mySerial(rxPin, txPin); // RX, TX
Encoder knobLeft(2, 5);
Encoder knobRight(3, 6);

String Counter1 = "";
int lastStringLength = Counter1.length();

MenuBackend menu = MenuBackend(menuUsed,menuChanged);
//initialize menuitems
    MenuItem menu1Item1 = MenuItem("Settings");
      MenuItem menuItem1SubItem1 = MenuItem("Wheel Circ");
      MenuItem menuItem1SubItem2 = MenuItem("Pulses");
      MenuItem menuItem1SubItem3 = MenuItem("Start Depth");
    MenuItem menu1Item2 = MenuItem("BH Info");
      MenuItem menuItem2SubItem1 = MenuItem("Filename");
      MenuItem menuItem2SubItem2 = MenuItem("Other");
      //MenuItem menuItem3SubItem3 = MenuItem("Item2SubItem3");
    MenuItem menu1Item3 = MenuItem("About");
    MenuItem menu1Item4 = MenuItem("Start");

void setup()
{
   Serial.begin(115200);
  mySerial.begin(115200);
  pinMode(buttonPinLeft, INPUT);
  pinMode(buttonPinRight, INPUT);
  pinMode(buttonPinEnter, INPUT);
  pinMode(buttonPinEsc, INPUT);
    
   lcd.begin(16,2);
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.print("DS - RDE");
  lcd.setCursor(0,1);
  lcd.print("SN: DSRDE001");
  delay(3000);
  lcd.setCursor(0,1);
  lcd.print("                ");
  delay(500);
  //configure menu
  menu.getRoot().add(menu1Item1);
  menu1Item1.addRight(menu1Item2).addRight(menu1Item3).addRight(menu1Item4);
  menu1Item1.add(menuItem1SubItem1).addRight(menuItem1SubItem2).addRight(menuItem1SubItem3);
  menu1Item2.add(menuItem2SubItem1).addRight(menuItem2SubItem2);//.addRight(menuItem3SubItem3);
  menu.toRoot();
 }  // setup()...

long positionLeft  = -999;
long positionRight = -999;

Any advise would be welcome.

Get rid of all the commented out code, put curly braces on separate lines and use the Arduino IDE's auto format tool to fix the indenting. You don't want people who can help you taking one look at it and thinking "the hell with this, I'm not weeding through that code."

And maybe point out somehow where the problem code is. There are no line numbers and I can't count to 400. While(1) is the same as delay(forever); If a button press is to exit the while loop why not read the button and use it as the while conditional?

the hell with this, I'm not weeding through that code

Thanks for the positive feedback. But sorted it anyways. Will tidy up the code and post tomorrow to indicate where my problem was.

Thanks guys

#define rxPin 0
#define txPin 1

SoftwareSerial mySerial(rxPin, txPin); // RX, TX

   Serial.begin(115200);
  mySerial.begin(115200);

Doing software serial on the same pins that you are doing serial on just is NOT going to work.

jakeshelm:
I have a piece of code which runs a menu and from a selection in the menu it is supposed to start a while(1) loop, however when I put in a break; based on a push button, the while(1) loop no longer read my quadrature encoder.

Your posted code has neither the word break nor while in it.

This is a trick question, right?