Help Starting Menu

Hi, everyone Been looking into building a menu to work with LCD shield (http://www.robotshop.com/dfrobot-lcd-keypad-shield-arduino.html?utm_source=google&utm_medium=base&utm_campaign=jos)

I want to start with a simple menu to get the hang of this. with 2 functions.

normal LCD operation Showing, time and date. then

press up or down

[Do Water Change] [Program Water Change]

[Do Water Change] function This will: - stop tank pumps and heater( Relay on PIN X ) - Pump1 ON till level switch1 activate....Pump1( Relay on PIN X ) - Pump3 ON till level switch2 activate....Pump2( Relay on PIN X ) OFF - Start tank pumps and heater

[Program Water Change] This will let me program a certain time to do the water change (once every 2 weeks) not sure how to do this maybe state every 15days.

Also I need to get a RTC wich I dont have in the moment.

Could anyone kick start me :P

If you need more info please ask, but I think I stated everything!

Thanks, Pedro

Could anyone kick start me

I'll kick you! http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1240415211

Was just looking into that. But how do I make my buttons work with this code ?

The example on that page shows how to navigate through the menus based on Serial data. Just change that code to navigate based on button presses, instead.

Hey Thanks for that.

Ofcourse its just changing the code to button presses but how to do that !? I’m trying to compare LCD4Bit to try and figure it out but… no success.

#include <MenuBackend.h>
#include <LCD4Bit_mod.h> 

LCD4Bit_mod lcd = LCD4Bit_mod(2); 


int  adc_key_val[5] ={30, 150, 360, 535, 760 };
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;


  void setup() { 
  pinMode(13, OUTPUT);  //we'll use the debug LED to output a heartbeat

  lcd.init();
  //optionally, now set up our application-specific display settings, overriding whatever the lcd did in lcd.init()
  //lcd.commandWrite(0x0F);//cursor on, display on, blink on.  (nasty!)
   lcd.clear();
  lcd.printIn("testing");
    
}

//this controls the menu backend and the event generation

MenuBackend menu = MenuBackend(menuUseEvent,menuChangeEvent);

      //beneath is list of menu items needed to build the menu
      MenuItem WC = MenuItem("Water Change");
            MenuItem manual = MenuItem ("MANUAL");
                MenuItem auto = MenuItem("AUTO");

//this function builds the menu and connects the correct items together
void menuSetup()
{
      lcd.println("Menu");
      //add the file menu to the menu root
      //when add is used, as opposed to addX as you see below, the item is added below the item it's added to
      menu.getRoot().add(WC); 
      //add all items below File to the file menu item, 
      //notice the arduino isp item is added _to the right_ of the examples item
      WC.add(manual).add(auto);
      //because edit item is to the right of the file item, we use the addRight method when inserting this item
      //then we add the cut item, because it is below the edit
}

/*
      This is an important function
      Here all use events are handled
      
      This is where you define a behaviour for a menu item
*/
void menuUseEvent(MenuUseEvent used)
{
      lcd.print("Menu use ");
      lcd.println(used.item.getName());
      if (used.item == "ArduinoISP") //comparison using a string literal
      {
            lcd.println("menuUseEvent found ArduinoISP");
      }
      if (used.item == miVerify) //comparison agains a known item
      {
            lcd.println("menuUseEvent found Verify (V)");
      }
}

/*
      This is an important function
      Here we get a notification whenever the user changes the menu
      That is, when the menu is navigated
*/
void menuChangeEvent(MenuChangeEvent changed)
{
      lcd.print("Menu change ");
      lcd.print(changed.from.getName());
      lcd.print(" ");
      lcd.println(changed.to.getName());
}

void setup()
{
      Serial.begin(9600);
      
      menuSetup();
      Serial.println("Starting navigation (see source for description):");

      menu.moveDown(2);  //move to file
      menu.moveDown();  //move to new
      menu.moveDown();  //move to open
      menu.moveDown();  //move to examples
      menu.moveRight(); //move to arduinoisp
      menu.use();       //use arduniisp
      menu.moveLeft();  //move to examples
      menu.moveUp();    //move to open
      menu.moveUp();    //move to new
      menu.moveUp();    //move to file
      menu.moveRight(); //move to edit
      menu.moveRight(); //move to sketch
      menu.moveDown();  //move to verify
      menu.use();       //use verify
      menu.moveBack();  //move back to sketch
      menu.moveBack();  //move back to edit
      menu.moveBack();  //move back to file
      menu.moveBack();  //move back to new
      menu.use();       //use new

      menu.use('V');    //use verify based on its shortkey 'V'
}

void loop()
{
  //
}

This is no making sense but… got to start from somewhere…