Need help with project

Dear arduino enhousiasts, we need to work on a project for school with arduino’s.
We are fairly new to this and kinda stuck on the code.

in this part of the project we are working with an LCD screen. With a single push of a button the lines of tekst change and display the Voltage in the applied battery. We would like to make it so after a second press of the button, the first lines of tekst comeback on the screen. is this possible?

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int analogInput = 2;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000.0;
float R2 = 10000.0;
int value = 0;

boolean motor = false;

void setup(){
Serial.begin(9600);
pinMode(analogInput, INPUT);
lcd.begin(16, 2);
delay(1000);

}
void loop(){
if(digitalRead(7) > 0) {
motor = true;
}

lcd.clear();
if(motor == false)
{
lcd.print(“Press button to”);
lcd.setCursor(0, 1);
lcd.print(“Start Engine”);

}
else
{
value = analogRead(analogInput);
vout = (value * 4.9) / 1024;
vin = vout / (R2/(R1+R2));
if (vin<0.09) {
vin=0.0;
}
lcd.print(“Voltage batterij”);
lcd.setCursor(0, 1);
lcd.print("V= ");
lcd.print(vin);
}

delay(200);

}

is this possible?

Easy, even.

The state change detection example show you how to determine that the "button", also known as a switch, has become, rather than is, pressed.

You can toggle the state of motor each time the switch becomes pressed.

thank you, but i don't understand what code i need to put in to make it so a second button press resets the LCD to default state?

felixvs:
thank you, but i don't understand what code i need to put in to make it so a second button press resets the LCD to default state?

Did you look at the StateChangeDetection example in the IDE ?
Do you understand how to detect when a button becomes pressed ? If you do, then you will be able to count how many times it has been pressed and act accordingly depending on that number.