make values common in all menus

Thanks, that makes sense.

how can I change the value of restingVoltage in the global scope via one of the menus?

This code doesn't work and I can't figure out why.

void menuItem2() { // Function executes when you select the 2nd item from main menu
  
  int activeButton = 0;
  int button;
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("VOlTS NOW =");
  lcd.setCursor(0,1);
  lcd.print ("REST SET");
  
 
  menuState2=true;
  

  while(menuState2==true){
  
  int sensorValue1 = analogRead(A2);
  voltage1 = sensorValue1  * (50.00 / 1024);
  lcd.setCursor (10,0);
  lcd.print(voltage1);
  lcd.setCursor (10,1);
  lcd.print(restingVoltage);
  analogRead(0);
  if(readKey <195){                //up button
    restingVoltage = 13.4 ;       // sets restingVoltage to 13.4
  }
    else if
    (readKey <380) {               //down button
      restingVoltage = 12.0;       // sets restingVoltage to 13.4
    }

  
  delay(100);
  
    readKey = analogRead(0);
    if (readKey < 790) {        
      delay(100);
      readKey = analogRead(0);
      
    button = evaluateButton(readKey);
    switch (button) {
      case 4:                  // This case will execute if the "back" button is pressed
        button = 0;
        activeButton = 1;
        menuState2=false;
        break;
    }
  }
}
} [code]

[/code]

This code doesn't work

Tells us nothing

What should it do ?
What does it do ?
Why did you not post the complete program ?

I've posted the full code on the first page. I've just updated it to where I am now.

using my LCD menu and buttons I am trying to change the value of "restingVoltage" which is a float in the global scope. Once the value has changed via my menu and buttons the code in my "home" menu will run with the newly set values.

Does the program ever call the menuItem2() function ?

No it doesn't.
Your comment gave me some food for though and I've got it working now, so thank you!

One last thing that would be useful to know, or if you can point me in the right direction to find out...

When I hold the up or down button in a menu, I want the value of X to change like this :
13.6, 13.7, 13.8, 13.9 ,14.0, 14.1 and so on....

But at the money when I hold a button it changes like this:
13.6, 14.6, 15.6, 16.6....

I've played about with it for most of the day and don't seem to be getting very far, or at least, I know how it doesn't work!

void menuItem2() { // Function executes when you select the 2nd item from main menu
  float x;
  x = 13.6;
  int activeButton = 0;
  int button;
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("VOlTS NOW =");
  lcd.setCursor(0,1);
  lcd.print ("REST SET");
  menuState2=true;

// this will run while menuState2 is true
  while(menuState2==true){
  int sensorValue1 = analogRead(A2);
  voltage1 = sensorValue1  * (50.00 / 1024);
  
// Setup and Print Values to LCD 
  lcd.setCursor (10,0);
  lcd.print(voltage1);
  lcd.setCursor (10,1);
  lcd.print(restingVoltage);
  
  readKey = analogRead(0);
  if(readKey == 99){          //holding the UP button 
    (restingVoltage =x++);    // will count from 13.6 
     restingVoltage = x;      // the value stopped at will be the value of X and restingVoltage
    }
    else if (readKey == 256) {    // holding the DOWN button
          (restingVoltage =x--);  //  will count from X down
     restingVoltage = x;          // the value stopped at will be the value of X and restingVoltage
    }
     delay(100);
 
    readKey = analogRead(0);
    if (readKey < 790) {
      
      delay(100);
      readKey = analogRead(0);
    button = evaluateButton(readKey);
    switch (button) {
      case 4:  // This case will execute if the "back" button is pressed
        button = 0;
        activeButton = 1;
        menuState2=false;
        
        break;
    }
  }
}
} [code]

[/code]

    (restingVoltage =x++);    // will count from 13.6

adds 1 to the value of x and assigns it to restingVoltage

try

   (x+= 0.1);    // will count from 13.6
restingVoltage = x;

or you cold just change the value of restingVoltage and not use an intermediate variable.

  float x;
  x = 13.6;

Why do you feel the need to use two lines of code to declare and initialize a value?

 float x = 13.6;
   (restingVoltage =x++);    // will count from 13.6

(Why) (are) (there) (parentheses) (in) (this) (statement) (?)

Why do you think that x = x + 1 should add 0.1?

PaulS:

I have no idea. I don't normally but thanks for pointing it out.

Again, I'm not sure - Thanks for pointing out that it was unnecessary.

I didn't think that, I just used that code as a way I could test the value was actually being changing so when I upped my input voltage the voltage was compared to the new changed values.
I asked for help to be able to add 0.1 because my other attempts didn't work.

Thanks