How to MENU program code with Keypad 4x4 and LCD 20X4

Hello, I have problem here, i wanna to make menu using my arduino and connected to the LCD display with driver 20x4 and keypad 4x4. In my program code that i use is Switch case instruction. i want to make that menu inside the menu it going to be a menu again. for example

MENU
[1]English
[2]Italian
[3]Chinese

when selected [1]

English
[1]Name
[2]Age

at here i wanna to make double Menu, but actually it not work at all.
I hope someone can help me with this problem
sorry with bad english.

i wanna to make double Menu, but actually it not work at all.

Please post your code and describe what happens when you run it.

Program code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3, POSITIVE); // Set the LCD I2C address
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'1','4','7','*'},
{'2','5','8','0'},
{'3','6','9','#'},
{'A','B','C','D'}
};
byte rowPins[ROWS] = {3, 2, 8, 0}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

void setup(){
lcd.begin(20,4);
Serial.begin(9600);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Select Your Language");
lcd.setCursor(0,1);
lcd.print("[1]English");
lcd.setCursor(0,2);
lcd.print("[2]Italian");
lcd.setCursor(0,3);
lcd.print("[3]Chinese");

}
void loop(){
char customKey = customKeypad.getKey();
language();

}

void language()
{

char customKey = customKeypad.getKey();
switch (customKey)
{
case '1':
lcd.clear();
lcd.setCursor(0,0);
lcd.print("English");
lcd.setCursor(0,1);
lcd.print("[1]Name");
lcd.setCursor(0,2);
lcd.print("[2]Age");
switch (customKey)
{
case '1':
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Your Name is Jack");
break;

case '2':
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Your Age is 29");
break;

}
break;

case '2':
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Italain");
lcd.setCursor(0,1);
lcd.print("[1]Nome");
lcd.setCursor(0,2);
lcd.print("[2]Età");
break;

}

}

when i run my this program code

first it showing like this

Select Your Language
[1]English
[2]Italian
[3]Chinese

when I press [1]

it show

Your Name is Jack

but actually i want it display

English
[1]Name
[2]Age

at the same time though the "Your Name is Jack"
im presser switch [2] it going to Italian

so the switch case that i use it not properly right. that make it switch case are only can be use once time only. I wanna to make sure that using the switch case, it can be use many with difference instruction.

  char customKey = customKeypad.getKey();
  switch (customKey)
  {
    case '1':
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("English");
      lcd.setCursor(0, 1);
      lcd.print("[1]Name");
      lcd.setCursor(0, 2);
      lcd.print("[2]Age");
      switch (customKey)
      {
        case '1':
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("Your Name is Jack");
          break;

You have nested switch/case statements using the value of customKey as the case variable but don't change its value between the first and second switches. So in he code above the program executes the code for both case '1' cases.

You need to display the menu level appropriate to the first user input then read the keypad again and take action based on the second user input.

can your explain little some, because i don't really understand.. is it need to change or make the customKey string?

Ok, I will try again.
In this code section

  char customKey = customKeypad.getKey();
  switch (customKey) 
  {
    case '1':  //customKey is '1'
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("English");
      lcd.setCursor(0, 1);
      lcd.print("[1]Name");
      lcd.setCursor(0, 2);
      lcd.print("[2]Age");
      switch (customKey)
      {
        case '1':    //customKey is still '1'
          lcd.clear();  //so this code executes
          lcd.setCursor(0, 0);
          lcd.print("Your Name is Jack");
          break;

you read input from the keypad and put it in the customKey variable then execute the first switch/case. If customKey is currently '1' then the English/Name/Age menu is displayed. So far, so good. I presume that you then want the user to enter a number on the keypad to choose what to do next but as customKey is already set to '1' so the second case '1' is executed immediately and the name is displayed.

What you need to do is to display the main menu, get user input, act on it by going to a sub menu then get user input again to select from the sub menu.

do you have any idea how to make that code?

Yes, what he's trying to tell you is that you need a second call to this function:

customKeypad.getKey();

to get the next selection instead of just using the key you already got for the first menu. If that is truly beyond you then perhaps you should set this code aside for a while and spend some time with some simpler codes and try to get the basics down before you try something more complex like a menu.

/* @file CustomKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates changing the keypad size and key values.
|| #
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3, POSITIVE); // Set the LCD I2C address
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'1','4','7','*'},
{'2','5','8','0'},
{'3','6','9','#'},
{'A','B','C','D'}
};
byte rowPins[ROWS] = {3, 2, 8, 0}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
Keypad customKeypad1 = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup(){
lcd.begin(20,4);
Serial.begin(9600);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Select Your Language");
lcd.setCursor(0,1);
lcd.print("[1]English");
lcd.setCursor(0,2);
lcd.print("[2]Italian");
lcd.setCursor(0,3);
lcd.print("[3]Chinese");
delay(200);

}
void loop(){

char customKey = customKeypad.getKey();
switch (customKey)
{
case '1':
s1();
char customKey1= customKeypad1.getKey();
switch (customKey1)
{
case '1':
s11();
break;
}
}
}
void s1()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("English");
lcd.setCursor(0,1);
lcd.print("[1]Name");
lcd.setCursor(0,2);
lcd.print("[2]Age");
delay(1000);
}
void s11()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Your Name is Jack");
}

I get it using the second customKey it working, but it have problem with code

  1. In the Display LCD, the menu at the English selection are to slow effect to get the input '1' to display the name.

When you call getKey again you should probably store the result in a variable so you can see what key was returned.