Push-button which changes info showing on lcd display

Hello community,

I've never written here and I don't know how to start...

My project is about installing car park sensors (six[6] hc04 and buzzer), raise and lower windows through my phone via the bluetooth module (jymcuhc06) and raise automaticaly depending on speed, temperature and humidity values, making a fog sensor, making a rain sensor and I want to show some information with a LCD display.

The question is the next: How can I do the info shown at the display changes using only a push-button? For example: first click --> show the shortest distance from the ultrasonic sensors; second click --> show speed; third click --> show temperature; fourth click --> show humidity; fifth click --> show again shortest distance.

THANKS!

davidpascu95

PD: I'll use UNO and Leonardo boards connected eachother via i2c

You'll have code that prints out to the screen. Keep up with how many times your button has been pushed and use that information to decide what you will display to the screen. I don't see how it could be much simpler.

Pseudocode:

numberOfButtonPresses = 0;

loop(){
    
check to see if button was pressed and add one to numberOfButtonPresses. 

If (numberOfButtonPresses == 0) {
  // write one thing to the display
}
else if (numberOfButtonPresses == 1) {
  //write something else to the display
}
else if (numberOfButtonPresses == 2) {
  //write yet some other thing to the display.
}

Thanx!

I'll see if it works.

If you (or someone else) could show me a program where it's used the bluetooth module jymcuhc06 i'll be very pleased.

davidpascu95