Arduino Functions Sketching problem

Hello everyone
I am interested in recording voice with an Arduino Uno luckily I have done the hardware part and I am stuck in programming.
The Arduino must constantly take measurements out of the microphone with delayMicroseconds(125) -until a switch is changed - and pass the outputValue in the Openstate_record_values part and let the programm keep running.Any suggestions are more than welcome.

Thank you in advance,

Napster

   #include <SD.h>
   #include <LiquidCrystal.h>

 //  File myFile;
   LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// These constants won't change.  They're used to give names
// to the pins used:

/* sensor eading Variables */
  const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
  const int onoffswitch = 6; // on/off switch
  const int record_button = 7; // record button A2 button
  const int memwrite = 10; // Analog output pin that the LED is attached to
  int sensorValue = 0;        // value read from the sensor
  int outputValue = 0;        // value output to the PWM (analog out)

//record_button == 0;      //initialising push button for recording
//int  record_button=A2  ;

//Controls
  int count = 0;              // global counter
  int onoffstate = 0 ; //=0;
  int recordstate = 0 ;
  
  void setup() {
  Serial.begin(9600);  // initialize serial communications at 9600 bps:
   pinMode(onoffswitch, INPUT);    //use slide switch as input , pin 6
   pinMode(record_button, INPUT);    // use slide switch as input , pin 7
   pinMode(memwrite,OUTPUT);  //set to digital pin 10 as Output where the data will be saved
   lcd.begin(16, 2);  //initialising a 16x2 LCD
                }
                
                
 //----------------------------

  void loop() {

      Switches();
     
        
               }

//-------------------------
 float Switches() {
                 lcd.clear();
                 lcd.home();
                  onoffstate  = digitalRead(onoffswitch);
      /*if  #1*/   if (onoffstate == HIGH){          
        
                      recordstate  = digitalRead(record_button);
      /*if  #2*/           if (recordstate == HIGH){
                               count = count + 1 ; 
                                while ( count % 2 != 0 )  {                 //if the count is an even number then start recording
                                      
                                      
                                     // Sensor_Reading();
                                       Openstate_record_values();//Getting the vinput from the sensor
      /*if  #3*/     
                                      if (recordstate == HIGH){
                                          count = count + 1 ; 
                            // &&&&&&&&&&&&&& add code to read-write to external memory (I will cover this part)
                                                                }//if #3 closing bracket
                                                          }  //while closing bracket
                                                  } //if #2 closing bracket       
                     else { // /*else for the if  #2*/
       //                    for(int j = 0; j < 17; j++){
                            lcd.clear();
                            lcd.home();
                            lcd.setCursor(10, 0);//changed from (0,0)
                            lcd.print("System is ON" );
                            
                            for(int j = 0; j < 17; j++){
                            lcd.setCursor(4, 1);
                            lcd.print("Please press button to record    " );  //The device is on but not recording
                            lcd.scrollDisplayLeft();
                            delay(200);
                         }  
                         }//else closing bracket 

        
                                  }//if #1 closing bracket

     /*if  #4*/       if (onoffstate != HIGH){
                          lcd.setCursor(1, 0);
                          lcd.print("System is OFF" );
                          delay(500);
                                     }//if #4 closing bracket
                     
  }//Switches bracket
  
//------------
  float Openstate_record_values() {
                       // int sensorValue = analogRead(analogInPin);            //must be places somehwere with no delay
                       // int outputValue = map(sensorValue, 0, 1023, 0, 255);
                        lcd.clear();
                        lcd.home();
                        lcd.setCursor(0, 0);
                        for(int j = 0; j < 17; j++){
                        lcd.print("Recording..." );
                        delay(400);
                        break;
                        }
                        lcd.clear();
                        lcd.home();
                        lcd.setCursor(0, 0);

                        lcd.print("Sensor=" );                       
                        lcd.print(sensorValue);
                        lcd.setCursor(0, 1);      
                        lcd.print("Output=");      
                        lcd.println(outputValue);   
                        digitalWrite(memwrite, outputValue);// *************this part must be places somewhere else with no delay
                        delay(500);
  }
  //--------------------
  float Sensor_Reading(){
    
                          int sensorValue = analogRead(analogInPin);            //must be places somehwere with no delay
                          int outputValue = map(sensorValue, 0, 1023, 0, 255);
                          digitalWrite(memwrite, outputValue);// *************this part must be places somewhere else with no delay
                          delayMicroseconds(125);
  }

please use CTRL-T in the IDE => it reformats your code to make the structure explicitely visible.

you will get something like

#include <SD.h>
#include <LiquidCrystal.h>

//  File myFile;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// These constants won't change.  They're used to give names
// to the pins used:

/* sensor eading Variables */
const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int onoffswitch = 6; // on/off switch
const int record_button = 7; // record button A2 button
const int memwrite = 10; // Analog output pin that the LED is attached to
int sensorValue = 0;        // value read from the sensor
int outputValue = 0;        // value output to the PWM (analog out)

//record_button == 0;      //initialising push button for recording
//int  record_button=A2  ;

//Controls
int count = 0;              // global counter
int onoffstate = 0 ; //=0;
int recordstate = 0 ;

void setup() 
{
  Serial.begin(9600);  // initialize serial communications at 9600 bps:

  pinMode(onoffswitch, INPUT);    //use slide switch as input , pin 6
  pinMode(record_button, INPUT);    // use slide switch as input , pin 7
  pinMode(memwrite,OUTPUT);  //set to digital pin 10 as Output where the data will be saved

  lcd.begin(16, 2);  //initialising a 16x2 LCD
}


void loop() 
{
  Switches();
}



float Switches() 
{
  lcd.clear();
  lcd.home();
  onoffstate  = digitalRead(onoffswitch);

  if (onoffstate == HIGH)
  {
    recordstate  = digitalRead(record_button);
    if (recordstate == HIGH)
    {
      count = count + 1 ; 
      while ( count % 2 != 0 )  //if the count is an even number then start recording
      {                 
        // Sensor_Reading();
        Openstate_record_values();//Getting the vinput from the sensor
        /*if  #3*/
        if (recordstate == HIGH)
        {
          count = count + 1 ; 
          // &&&&&&&&&&&&&& add code to read-write to external memory (I will cover this part)
        }
      } 
    }       
    else
    {
      //                    for(int j = 0; j < 17; j++){
      lcd.clear();
      lcd.home();
      lcd.setCursor(10, 0);//changed from (0,0)
      lcd.print("System is ON" );

      for(int j = 0; j < 17; j++)
      {
        lcd.setCursor(4, 1);   
        lcd.print("Please press button to record    " );  //The device is on but not recording
        lcd.scrollDisplayLeft();

        delay(200);
      }  
    }
  }

  /*if  #4*/
  if (onoffstate != HIGH)
  {
    lcd.setCursor(1, 0);
    lcd.print("System is OFF" );
    delay(500);
  }
}

float Openstate_record_values() 
{
  // int sensorValue = analogRead(analogInPin);            //must be places somehwere with no delay
  // int outputValue = map(sensorValue, 0, 1023, 0, 255);
  lcd.clear();
  lcd.home();
  lcd.setCursor(0, 0);

  for(int j = 0; j < 17; j++)
  {
    lcd.print("Recording..." );
    delay(400);
    break;
  }

  lcd.clear();
  lcd.home();
  lcd.setCursor(0, 0);
  lcd.print("Sensor=" );                       
  lcd.print(sensorValue);
  lcd.setCursor(0, 1);      
  lcd.print("Output=");      
  lcd.println(outputValue); 

  digitalWrite(memwrite, outputValue);// *************this part must be places somewhere else with no delay
  delay(500);
}

float Sensor_Reading()
{
  int sensorValue = analogRead(analogInPin);            //must be places somehwere with no delay
  int outputValue = map(sensorValue, 0, 1023, 0, 255);
  digitalWrite(memwrite, outputValue);// *************this part must be places somewhere else with no delay
  delayMicroseconds(125);
}

makes you need far less comments !