lcd keypad

hello there,

i am making an arduino powerder ''shotbot'' for my dad. but i want to control the volume which is poured out the bottle through an lcd key pad. on the first line i wnat to have it say ''bacardi shot'' and on the second line of the lcd i want it to say ''volume = x'' and the X defines the amount of milliliters it wil pour out. and i only want to use the up and down keys of the keypad and one button to the ''right one" button to confirm the amount but i have kinda a problem with the programming because i am new to the lcd keypad how to program it.

thanks in advance,

Which LCD keypad?

You have some code now. Show it to us. Explain what it does and what you want it to do differently.

I dont have any code becaus ei dont want to make it a huge mess or something like that because i have no idea where to start yea ofcourse the pins which the keypad uses etc.

No guarantees but try this example code

/* FILE:    ARD_LCD_HCARDU014_Buttons_Example.pde
   DATE:    02/07/12
   VERSION: 0.1

 This is a simple example of how to use the buttons included on the 
 HobbyComponents Arduino LCD shield (HCARDU0014). The shield will work 
 with the standard Arduino LiquidCrystal library.
 
 The buttons when pressed apply different offset voltages to the
 Arduino ADC0. Reading the ADC will give an ADC code in the following 
 range depending on which button has been pressed:

     Between 0 & 49 = RIGHT button pressed.
     Between 50 & 194 = UP button pressed.
     Between 195 & 379 = DOWN button pressed.
     Between 380 & 555 = LEFT button pressed.
     Between 555 & 789 = SELECT button pressed.
  
     Above and ADC code of 790, assume no button has been pressed.
  
LCD Backlight considerations

By default the LiquidCrystal library does not attempt to control the backlight
and therefore the backlight will default to being permanently on. If you do not 
need to change the state of the backlight you can ignore the following information:

When overriding the state of the backlight via DIO10 from your own code, you must 
drive the pin in one of two modes:

Backlight   DIO10
OFF      OUTPUT/LOW
ON      INPUT

DO NOT configure DIO to be and OUTPUT/HIGH as this can cause excessive current 
to be drawn from DIO10.

You may copy, alter and reuse this code in any way you like but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/



/* Include the standard LiquidCrystal library */
#include <LiquidCrystal.h>


/* DIO pin definitions */
#define LCD_DATA4 4         /* LCD data DIO pin 4 */
#define LCD_DATA5 5         /* LCD data DIO pin 5 */
#define LCD_DATA6 6         /* LCD data DIO pin 6 */
#define LCD_DATA7 7         /* LCD data DIO pin 7 */
#define LCD_RESET 8         /* LCD Reset DIO pin */
#define LCD_ENABLE 9        /* LCD Enable DIO pin */
#define LCD_BACKLIGHT 10    /*LCD backlight DIO pin */


/* Definitions for current button state */
typedef enum
{
  E_LCD_BTN_RIGHT,          /* LCD RIGHT button pressed */
  E_LCD_BTN_UP,             /* LCD UP button pressed */
  E_LCD_BTN_DOWN,           /* LCD DOWN button pressed */
  E_LCD_BTN_LEFT,           /* LCD LEFT button pressed */
  E_LCD_BTN_SELECT,         /* LCD SELECT button pressed */
  E_LCD_BTN_NONE,           /* LCD NONE button pressed */
} 
teButtonState;       


/* Initiliase the LiquidCrystal library with the correct DIO pins */
LiquidCrystal lcd(LCD_RESET, LCD_ENABLE, LCD_DATA4, LCD_DATA5, LCD_DATA6, LCD_DATA7);


void setup() {

  /* Set the correct display size (16 character, 2 line display) */
  lcd.begin(16, 2);  
}


/* Main program loop */
void loop() 
{

  /* Put the LCD cursor on the first row and prompt the user to press a button */
  lcd.setCursor(0,0); 
  lcd.print("Press a button...");

  /* Keep checking for a button press */
  while (1)
  {
    /* Put the LCD cursor on the second row */
    lcd.setCursor(0,1); 

    /* Get the current state of the LCD buttons */
    switch(iGetLCDButtonState())
    {
      /* If the RIGHT button has been pressed then display this on the LCD */
    case E_LCD_BTN_RIGHT:
      lcd.print("RIGHT ");
      break;

      /* If the LEFT button has been pressed then display this on the LCD */
    case E_LCD_BTN_LEFT:
      lcd.print("LEFT   ");
      break;

      /* If the UP button has been pressed then display this on the LCD */
    case E_LCD_BTN_UP:
      lcd.print("UP    ");
      break;

      /* If the DOWN button has been pressed then display this on the LCD */
    case E_LCD_BTN_DOWN:
      lcd.print("DOWN  ");
      break;

      /* If the SELECT button has been pressed then display this on the LCD */
    case E_LCD_BTN_SELECT:
      lcd.print("SELECT");
      break;

      /* If no button has been pressed then display NONE on the LCD */
    case E_LCD_BTN_NONE:
      lcd.print("NONE  ");
      break;
    }
  }
}

/* Read the current state of the LCD buttons using the ADC */
int iGetLCDButtonState()
{
  int iADC_Value;
  int iADC_Button_State = E_LCD_BTN_NONE;

  iADC_Value = analogRead(0);      /* Read the ADC */


  /* If ADC reads above 1000 then assume no buttons have been pressed */
  if (iADC_Value > 1000) 
  {
    iADC_Button_State = E_LCD_BTN_NONE;
  } 
  else /* If it was below 1000 then a button is pressed... */
  {

    /* If ADC reads between 0 & 49, then the RIGHT button has been pressed */
    if (iADC_Value < 50)             
    {
      iADC_Button_State = E_LCD_BTN_RIGHT; 
    }
    else
    {
      /* If ADC reads between 50 & 194, then the UP button has been pressed */
      if (iADC_Value < 195)
      {      
        iADC_Button_State = E_LCD_BTN_UP;      
      }
      else
      {
        /* If ADC reads between 195 & 379, then the DOWN button has been pressed */
        if (iADC_Value < 380) 
        { 
          iADC_Button_State = E_LCD_BTN_DOWN;
        }
        else
        {
          /* If ADC reads between 380 & 555, then the LEFT button has been pressed */
          if (iADC_Value < 555)  
          {
            iADC_Button_State = E_LCD_BTN_LEFT;
          }
          else
          {
            /* If ADC reads between 555 & 789, then the SELECT button has been pressed */
            if (iADC_Value < 790)  
              iADC_Button_State = E_LCD_BTN_SELECT;  
          }
        }
      }
    }
  }
  return iADC_Button_State;
}

Here's a Youtube video which discusses building a menu and navigating with buttons. With a few name changes you may be able to adapt it for your use.

So you have something like DFROBOT's LCD KeyPad Shield For Arduino?

The page contains some simple examples that you can start with.

What are you going to use to control the amount of liquor that comes from the barrel ( :smiley: )?

PS
You posted in 'programming questions'; in general that is where we try to help people with programming problems and you need to have code for that :wink: For approaches and more general advise, your question might have fitted better in the 'project guidance' section. But anyway, cheers :wink:

Thanks for al the replies i will try it out and let you know i just wanted to be prepared so you guys help me a lot any other advice will be welcome

And for @sterretje i thought if i knew how much liquor it will pump out per min i will just divided it so i can calcute how many liquor it will be per second and then just let the pumo run for an amount of seconds so the amount of liquor what is confirmed through the keypad will pour out the bottle

Have you considered how you are going to control the pump (relay, fet)? What kind of pump (12V, 220V)?

Its an 12v pump and i qm going to control it through an relay

OK, that should not pose too many problems.