How to clr lcd 16x2 after its disconnected

Hi All;

I am looking for some advice or pointers programming the arduino. I just started working with the arduino mega256, osepp 16x2 lcd keypad shield and I am trying to used this as a voltmeter. I have connected everything correct electrically and the small program that i wrote does indicate the correct voltage, however when I disconnect the power supply on the lcd panel still shows numbers.

I tried using the lcd.clear(), but this clears the whole display and I just want to clear the last viewed voltage displayed. I would like to only display V1 and V2 on the lcd panel. Any suggestions on how I can do that??

Also, on the lcd panel do i need to setup the reset button? Or is that a given to always be enabled? For some reason the reset button does not work with this code, but if i use an example code the reset works fine…

oid setup() {
  //this setups up the variables to 0
  
  
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  
  
  
  
  //this is added for testing to see what is happening
  Serial.begin(9600);
  
}


void loop() 
{
 
 
  int const OVERVOLTAGE    = 5.30;
  int const NOMINALVOLTAGE = 4.85;
  int const UNDERVOLTAGE   = 4.30;
  
  //need to display voltage from tp1 to tp2
  
  // read the input on analog pin 15:
 int sensorValue = analogRead(A15);

  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  
   float voltage = sensorValue * (5.0 / 1023.0);
  //print out the value you read:
    Serial.println(voltage);  
  
  
//need a loop that chks for voltage of 4.00V and 5.30V to blink, blinking indicates an error  
  if (voltage < UNDERVOLTAGE)
  {
  
     lcd.setCursor(0, 0);
     lcd.print("V1: "); + lcd.print(voltage);
     delay (5000);
 //added for testing
  Serial.println(voltage); + Serial.println("V1");
  Serial.println("V1 only");
  delay (5000);
  
  }
    else if (OVERVOLTAGE > voltage)

  {
    
    lcd.setCursor(1, 1);
    lcd.print("V2: "); + lcd.print(voltage);
 //added for testing
     Serial.println("V2"); + Serial.println(voltage);
     delay (5000);
    
    }
  
      else if (voltage == NOMINALVOLTAGE)

     {
        lcd.setCursor(9, 1);
        lcd.print("V2: "); + lcd.print(voltage);
     //added for testing
       Serial.println("V2"); + Serial.println(voltage);
       delay (5000);
     }
}

and I just want to clear the last viewed voltage displayed.

So, print space over the currently displayed values. It is not that difficult.

What is up with the horrid indenting in your code?

Use Tools + Auto Format before posting code again.

How is the Arduino supposed to know that you are done viewing the last displayed values?

If you just want to clear out a couple of characters then just go back and print spaces over them.