LCD Increment and Decrement For Display

Dear all.
I am trying to call Display menu. If up key is pressed Displayed has to be incremented and stay in particular window if Decremented, go to previous Display function and show previous Display function.

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
static int button_counter=0;
#define btnRIGHT  0		// Okay
#define btnUP     1		// inc
#define btnDOWN   2		// dec
#define btnLEFT   3		// Select
#define btnSELECT 4		// Menu
#define btnNONE   5
#define beeper A1      // Alarm buzzer
#define shortBeep 100
#define longBeep  500

void setup()
{
Serial.begin(9600);
}
void loop()
{
lcd_call();
}

 void lcd_call()
{

 int button = read_LCD_buttons();  



if(button==btnUP)
{
 button_counter=button_counter+1; 
 Serial.print("button_counter");
 Serial.println(button_counter);
}else if(button==btnDOWN)
{
  button_counter=button_counter-1; 
   Serial.println(button_counter);
}

if (button_counter>5)
{
  button_counter=1;
}else

while(button_counter<5)
{
   int button = read_LCD_buttons();  
  if(button != prev_button && button !=  btnNONE)
{
  prev_button = button; 
//timedBeep(shortBeep,2); 
}

if ((((button ==btnUP )||(button_counter==1))||((button ==btnDOWN )))&&(prev_button==btnUP))
{
digitalClockDisplay();//timedBeep(200,1); 

}else if((((button ==btnUP )||(button_counter==2))||((button ==btnDOWN )))&&(prev_button==btnUP))
{
 Display_angle();//timedBeep(200,1); 
}else if((((button ==btnUP )||(button_counter==3))||((button ==btnDOWN )))&&(prev_button==btnUP))
{
Display_coordinate();//timedBeep(200,1); 
}else if((((button ==btnUP )||(button_counter==4))||((button ==btnDOWN )))&&(prev_button==btnUP))
{
  button_loop();//timedBeep(500,4); 
}else if((((button ==btnUP )||(button_counter==5))||((button ==btnDOWN )))&&(prev_button==btnUP))
{
   Display_Wind();//timedBeep(200,1); 
}
  
}
}


void Display_Wind()
{
....Display Wind perameter........
}
void button_loop()
{
.....Button loop selection.........
}
void Display_coordinate()
{
.....Display coordinate.........
}
void  Display_angle()
{
......Display angle........
}
void digitalClockDisplay()
{
.......Display Date and time.........
}

I AM CREATING SIMPLE MENU AS BELOW. I HAVE 5 KEYS

  • MENU -> SELECT/OK
  • UP -> increment value/menu
  • DOWN->decrement value/menu
  • ESC->EXIT
  • RESET->RESET all PERAMETER

MENU:

  • Display menu
  • Set menu

In Display menu :

  • date/time
  • coordinate
  • wind load
  • Desired angle

In SET menu

  • Set date and time
  • set coordinate
  • set start time and stop time

once enter into display it should be display menu, and by selecting up and down arrow i can see display window.it should stay in same window unless ESC key pressed or Display count exceed

Algorithm For Display selection