Drink machine lcd menu ??

Hey

so i’m looking to make a drink machine so i need to create a menu where the user can select what drink he want.
I only goth a 16 x 2 lcd display
The menu / drinks needs to be loaded from a sdcard. And the menu needs to alow the user to create their own drink with amount from what bottle number.

I have been looking at this project GitHub - DavidAndrews/Arduino_LCD_Menu: This library creates menu systems primarily useful for 16x2 or 16x4 LCD displays. witch I like the layout off but I can’t find a way to control what drink information is used when selecting different drinks ?

Any othere projects that can offer the same ?? ore am i just falling the to use the code from the lib above ??

!(http://#include <LiquidCrystal.h>
#include “MenuEntry.h”
#include “MenuLCD.h”
#include “MenuManager.h”

//LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
//Now create the MenuLCD and MenuManager classes.
MenuLCD g_menuLCD( 8, 9, 4, 5, 6, 7, 16, 2);
MenuManager g_menuManager( &g_menuLCD);//pass the g_menuLCD object to the g_menuManager with the & operator.

int g_timerTime = 23;
long g_timerRunning = false;
long g_timerTarget = 0;
long g_autoReset = false;
long g_stopMillis = 0;
long g_startMillis = 0;
//Global variables used by the sample application
//when the display is showing user results (e.g. time elapsed), the next “select” should send it back into the menu.
unsigned int g_isDisplaying = false;

int drinksArraySize = 10;
char* drinks[10] = {“12341”,“2”,“3”,“4”,“5”,“6”,“7”,“8”,“9”,“10”};

int selected =0;
int drinkSelected;

void setupMenusV2(){
g_menuLCD.MenuLCDSetup();
//Add nodes via a depth-first traversal order
MenuEntry * p_menuEntryRoot;
//Add root node
//MenuEntry( char * menuText, void * userData/=0/, MENU_ACTION_CALLBACK_FUNC func);
p_menuEntryRoot = new MenuEntry(“drinks maskine”, NULL, NULL);
g_menuManager.addMenuRoot( p_menuEntryRoot );
// g_menuManager.addChild( new MenuEntry(“lav drink”, NULL, LavDrinkCallBack));
// g_menuManager.addChild( new MenuEntry(“indhold”, NULL, NULL ) );
// g_menuManager.addChild( new MenuEntry(“Back”, (void *) &g_menuManager, NULL) );
//
// g_menuManager.addSibling(new MenuEntry(“timer”,NULL,NULL));
// g_menuManager.MenuDown();
// g_menuManager.addChild( new MenuEntry(“lav drink”, NULL, LavDrinkCallBack));
// g_menuManager.addChild( new MenuEntry(“indhold”, NULL, NULL ) );
// g_menuManager.addChild( new MenuEntry(“Back”, (void *) &g_menuManager, NULL) );
//

for (int i =0;i<drinksArraySize;i++)
{

g_menuManager.addSibling(new MenuEntry(drinks*,NULL,drinkSelectedCallBack));*

  • g_menuManager.MenuDown();*

  • g_menuManager.addChild( new MenuEntry(“lav drink”, NULL, LavDrinkCallBack));*

  • g_menuManager.addChild( new MenuEntry(“indhold”, NULL, NULL ) );*
    g_menuManager.addChild( new MenuEntry(“Back”, (void *) &g_menuManager, NULL) );

  • }*

  • g_menuManager.SelectRoot();*

  • g_menuManager.DrawMenu();*
    }
    void setup()
    {

  • Serial.begin(9600);*

  • Serial.print(“Ready.”);*

  • setupMenusV2();*
    }
    void loop()
    {

  • //The example shows using bytes on the serial port to move the menu. You can hook up your buttons or other controls.*

  • char incomingByte = 0;*

  • if (Serial.available() > 0)*

  • {*

  • incomingByte = Serial.read();*

  • }*

  • switch( incomingByte )*

  • {*

  • case ‘u’:*

  • drinkSelected --;*

  • g_menuManager.DoMenuAction( MENU_ACTION_UP );*

  • break;*

  • case ‘d’:*

  • g_menuManager.DoMenuAction( MENU_ACTION_DOWN );*

  • drinkSelected ++;*

  • break;*

  • case ‘s’:*

  • if( g_isDisplaying )*

  • {*

  • g_isDisplaying = false;*

  • g_menuManager.DrawMenu();*

  • }*

  • else*

  • {*

  • g_menuManager.DoMenuAction( MENU_ACTION_SELECT );*

  • }*

  • break;*

  • case ‘b’:*

  • g_menuManager.DoMenuAction( MENU_ACTION_BACK );*

  • break;*

  • default:*

  • break;*

  • }*

}
void drinkSelectedCallBack(char* pMenuText, void *pUserData){
_ char *pLabel = “Timer seconds”;_

  • int iNumLabelLines = 1;*

  • int iMin = 1;*

  • int iMax = 1000;*

  • int iStart = 60;*

  • //Each user input action (such as a turn of rotary enocoder or push of button*

  • //will step this amount*

  • int iStep = 5;*

  • g_menuManager.DoIntInput( iMin, iMax, iStart, iStep, &pLabel, iNumLabelLines, &g_timerTime );*

  • Serial.print(“Timer time” );*

}
void LavDrinkCallBack(char* pMenuText, void *pUserData){

  • Serial.println(“ds”+drinkSelected);*
    }[/img])

simondid:
Hey

so i’m looking to make a drink machine so i need to create a menu where the user can select what drink he want.
I only goth a 16 x 2 lcd display
The menu / drinks needs to be loaded from a sdcard. And the menu needs to alow the user to create their own drink with amount from what bottle number.

I have been looking at this project GitHub - DavidAndrews/Arduino_LCD_Menu: This library creates menu systems primarily useful for 16x2 or 16x4 LCD displays. witch I like the layout off but I can’t find a way to control what drink information is used when selecting different drinks ?

Any othere projects that can offer the same ?? ore am i just falling the to use the code from the lib above ??

this is the code i used but it aint working just for testing …

#include <LiquidCrystal.h>
#include “MenuEntry.h”
#include “MenuLCD.h”
#include “MenuManager.h”

//LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
//Now create the MenuLCD and MenuManager classes.
MenuLCD g_menuLCD( 8, 9, 4, 5, 6, 7, 16, 2);
MenuManager g_menuManager( &g_menuLCD);//pass the g_menuLCD object to the g_menuManager with the & operator.

int g_timerTime = 23;
long g_timerRunning = false;
long g_timerTarget = 0;
long g_autoReset = false;
long g_stopMillis = 0;
long g_startMillis = 0;
//Global variables used by the sample application
//when the display is showing user results (e.g. time elapsed), the next “select” should send it back into the menu.
unsigned int g_isDisplaying = false;

int drinksArraySize = 10;
char* drinks[10] = {“12341”,“2”,“3”,“4”,“5”,“6”,“7”,“8”,“9”,“10”};

int selected =0;
int drinkSelected;

void setupMenusV2(){
g_menuLCD.MenuLCDSetup();
//Add nodes via a depth-first traversal order
MenuEntry * p_menuEntryRoot;
//Add root node
//MenuEntry( char * menuText, void * userData/=0/, MENU_ACTION_CALLBACK_FUNC func);
p_menuEntryRoot = new MenuEntry(“drinks maskine”, NULL, NULL);
g_menuManager.addMenuRoot( p_menuEntryRoot );
// g_menuManager.addChild( new MenuEntry(“lav drink”, NULL, LavDrinkCallBack));
// g_menuManager.addChild( new MenuEntry(“indhold”, NULL, NULL ) );
// g_menuManager.addChild( new MenuEntry(“Back”, (void *) &g_menuManager, NULL) );
//
// g_menuManager.addSibling(new MenuEntry(“timer”,NULL,NULL));
// g_menuManager.MenuDown();
// g_menuManager.addChild( new MenuEntry(“lav drink”, NULL, LavDrinkCallBack));
// g_menuManager.addChild( new MenuEntry(“indhold”, NULL, NULL ) );
// g_menuManager.addChild( new MenuEntry(“Back”, (void *) &g_menuManager, NULL) );
//

for (int i =0;i<drinksArraySize;i++)
{

g_menuManager.addSibling(new MenuEntry(drinks*,NULL,drinkSelectedCallBack));*

  • g_menuManager.MenuDown();*

  • g_menuManager.addChild( new MenuEntry(“lav drink”, NULL, LavDrinkCallBack));*

  • g_menuManager.addChild( new MenuEntry(“indhold”, NULL, NULL ) );*
    g_menuManager.addChild( new MenuEntry(“Back”, (void *) &g_menuManager, NULL) );

  • }*

  • g_menuManager.SelectRoot();*

  • g_menuManager.DrawMenu();*
    }
    void setup()
    {

  • Serial.begin(9600);*

  • Serial.print(“Ready.”);*

  • setupMenusV2();*
    }
    void loop()
    {

  • //The example shows using bytes on the serial port to move the menu. You can hook up your buttons or other controls.*

  • char incomingByte = 0;*

  • if (Serial.available() > 0)*

  • {*

  • incomingByte = Serial.read();*

  • }*

  • switch( incomingByte )*

  • {*

  • case ‘u’:*

  • drinkSelected --;*

  • g_menuManager.DoMenuAction( MENU_ACTION_UP );*

  • break;*

  • case ‘d’:*

  • g_menuManager.DoMenuAction( MENU_ACTION_DOWN );*

  • drinkSelected ++;*

  • break;*

  • case ‘s’:*

  • if( g_isDisplaying )*

  • {*

  • g_isDisplaying = false;*

  • g_menuManager.DrawMenu();*

  • }*

  • else*

  • {*

  • g_menuManager.DoMenuAction( MENU_ACTION_SELECT );*

  • }*

  • break;*

  • case ‘b’:*

  • g_menuManager.DoMenuAction( MENU_ACTION_BACK );*

  • break;*

  • default:*

  • break;*

  • }*

}
void drinkSelectedCallBack(char* pMenuText, void *pUserData){
_ char *pLabel = “Timer seconds”;_

  • int iNumLabelLines = 1;*

  • int iMin = 1;*

  • int iMax = 1000;*

  • int iStart = 60;*

  • //Each user input action (such as a turn of rotary enocoder or push of button*

  • //will step this amount*

  • int iStep = 5;*

  • g_menuManager.DoIntInput( iMin, iMax, iStart, iStep, &pLabel, iNumLabelLines, &g_timerTime );*

  • Serial.print(“Timer time” );*

}
void LavDrinkCallBack(char* pMenuText, void *pUserData){

  • Serial.println(“ds”+drinkSelected);*
    }[/quote]