Trouble with Digital Clock Display within Vertical Menu

Hey guys - pretty new here so try not to be too harsh on me. I’m trying to get the VerticalMenu i got from The Making of a Maker: Simple Vertical Menu for Arduino LCD Shield to work with my DigitalClockDisplay. The menu works great with my setup - I can press a button and will take me inside the menu options. I can also get it to display the time when I press ‘Display Time’ on the LCD Keypad that’s connected to my RTC module.

I have two main issues:
(1): I don’t understand how it retrieves the menu options. I only want it to display time when I press display time, not set alarm or set song.
(2): When it does display the time, it doesn’t “tick” the time like it does when the DigitalClockDisplay is on its own (not within this menu loop). It just displays the time that it was when I pressed the button.

Here is my loop:

void loop()
{
    // The menu entries list needs to end with a blank entry and each item 
    // can only be 15 characters long:
    //                      [               ]
    PROGMEM char* menu1[]={ "Display Time",
                            "Set Alarm",
                            "Set Song",
                            "Table?",
                            ""};

    int selection = menuSelection(menu1);

    if (selection != 3) {
           lcd.setCursor(0,1);
           lcd.clear();
           digitalClockDisplay();  
           delay(1000);
    }
    else {
        int buttonPressed = btnNONE;
        for (int i = 8; i < 64; i++) {
            lcdMessage = "Asc " + String(i * 4 + 0);
            lcdMessage += " ";
            lcdMessage += char(i * 4 + 0);
            lcdMessage += " ";
            lcdMessage += char(i * 4 + 1);
            lcdMessage += " ";
            lcdMessage += char(i * 4 + 2);
            lcdMessage += " ";
            lcdMessage += char(i * 4 + 3);
            lcdMessage += " ";
            lcdText(0, lcdMessage);
            lcdText(1, "Right to quit");
            
            // Wait for any button to be pressed
            while (buttonPressed == btnNONE) {
                buttonPressed = readButtons();
                delay(100);
            }
            // Terminate our loop on btnRIGHT
            if (buttonPressed == btnRIGHT) {
                i = 99;
            }
            buttonPressed = btnNONE;
            
            delay(100);     // Little delay to let the key pad settle            
        }
    }
    
    delay(1000);
}

Here is how it does the menu selection:

int menuSelection(char *menu[]) {
    String temp="                ";
    int selection = 0;
    while (1 == 1) {
        // First char of top line to indicates it will be selected
        temp = String(menu[selection]);
        temp = String(char(126) + temp);
        lcdText(0, temp);
        // Empty line means we are at the end
        if (menu[selection + 1][0] != 0) {
            temp = String(menu[selection + 1]);
            temp = String(" " + temp);
            lcdText(1, temp);
        }
        else {
            lcdText(1, "");
        }

        // Read the keypad buttons
        int lcdKey = readButtons();  
        switch (lcdKey) {
            case btnUP:
            {
                // Decr our selection if we are not at the top
                if (selection > 0) {
                    selection--;
                }
                break;
            }
            case btnDOWN:
            {
                // Incr our selection if we are not at the bottom
                if ((selection < 5) && (menu[selection + 1][0] != 0)) {
                    selection++;
                }
                break;
            }
            case btnSELECT:
            {
                delay(250);
                return(selection);
                break;
            }
        }
        delay(150);
    }
}

The link to my whole code is VerticalMenu_Time - Google Docs

Any advise would be greatly appreciated

Any advise would be greatly appreciated

Post your code properly, as an attachment. I don't do google crocks.

Sorry about that - I didn’t see that on the guide on how to post.

My code is attached (hopefully right this time).

VerticalMenu_Time.ino (7.68 KB)

     lcd.noDisplay();
     delay(0);
      // Turn on the display:
     lcd.display();

WTF?

    PROGMEM char* menu1[]={ "Display Time",
                            "Set Alarm",
                            "Set Song",
                            "Japanese Table",
                            ""};

    int selection = menuSelection(menu1);

PROGMEM char * is not the same as char *. menuSelection expects a char array, not a PROGMEM char array.

You really need to ditch the stupid String class.