Storing Multiple Values from LCD Keypad Shield

I am trying to enter in and store three values from the LCD Keypad shield, unsuccessfully. This is my fist arduino program but I have basic experience with C.

What I want to do: I’m making a dip-coater that will lower something very slowly over a specified distance and then return at a different rate. I have the motor shield set up and ready. it just needs the downward speed, the distance, and upward speed input from the keypad.

What I’m working with: DIYMall 1602 lcd keypad shield, arduino uno.

What I need help with: I have been able to successfully enter and save one value through the keypad but when i try and duplicate it for three values I am running into all sorts of problems. No actual errors, only problems. I need help figuring out where I should be placing each call to a function and how to get each call to save the given variable. As is, I try to get the three variables from the keypad in the setup stage so that in the loop I can just let the motor run at the given speeds and distance. It seems to just skip over the function to get inputs from the keypad. It will show “enter speed”, “enter distance”, and “enter reverse” but will not go into the function to allow the user to enter and store a variable. A lot of the keypad code I used from a layout my friend made for a similar program with only one input required.

Any help or suggestions are appreciated, thanks.

#include <LiquidCrystal.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(8,9,4,5,6,7);

enum {btnNONE, btnSELECT, btnLEFT, btnUP, btnDOWN, btnRIGHT, NUM_KEYS };

const byte ButtonsPin= A0;
char value[]= "000";
int cursorPos = 0;
boolean lcdNeedsUpdate=true;
double MotorSpeed = 0;
double Depth = 0;
double Reverse = 0;
int x = 0;
int a = 0;




void setup() 
{
  Serial.begin(9600);
  lcd.begin(16,2);
  lcd.clear();
  lcd.print("Dip Coater");
  delay(1000);
  lcd.clear();
  lcd.setCursor(0,0);
  
   while (a == 0)
  {
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Enter Speed: ");
  lcd.blink();
  double Input1(double Motorspeed);
  Serial.println(MotorSpeed);
  a = a++;
  break;
  }
  
  while (a > 0 || a < 2)
  {
  lcd.clear();  
  lcd.setCursor(0,0);
  lcd.print("Enter Depth: ");
  lcd.blink();
  double Input2(double Depth);
  Input2(Depth);
  Serial.println(Depth);
  a = a++;
  break;
  }
  
  while (a > 1 || a < 3)
  {
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Reverse Speed: ");
  lcd.blink();
  double Input3(double Reverse);
  Input3(Reverse);
  Serial.println(Reverse);
  a = a++;
  break;
  } 
 
}


void loop() 
{
    // This would be the code for telling the motor to go down at Motorspeed, for depth of Depth, and return at Return speed.
    // myMotor->setSpeed(MotorSpeed);  
    // myMotor->step(MotorSpeed, FORWARD, INTERLEAVE);  
  
 }
  
int read_LCD_buttons()
{
  int returnValue;
  // read ADC value of pressed button
  int adc_key_in =  analogRead (ButtonsPin);
  int adc_key_in1=  analogRead (ButtonsPin);
  // read again and check for stable ADC reading (software debouncing for analog input)
  if (abs(adc_key_in1-adc_key_in)>3) return btnNONE; // if ADC reading is not stable, return btnNONE
  if (adc_key_in <50) returnValue= btnRIGHT;
  else if (adc_key_in <150) returnValue= btnUP;
  else if (adc_key_in <325) returnValue= btnDOWN;
  else if (adc_key_in <500) returnValue= btnLEFT;
  else if (adc_key_in <800) returnValue= btnSELECT;
  else returnValue=btnNONE;
  // simple "blocking" code: "Busy waiting" until button is released by user
  while(adc_key_in<800) adc_key_in= analogRead(ButtonsPin);
  return returnValue;
}

 //function to read input from the screen and return a plunge speed
 double Input1(double Motorspeed)
 {
   
  char key=read_LCD_buttons();
  if (key!= btnNONE) lcdNeedsUpdate=true;

  switch (key) 
  {
    case btnRIGHT:
      if (cursorPos<2) cursorPos++;
      break;
    case btnLEFT:  
      if (cursorPos>0) cursorPos--;
     
      break;
    case btnUP:
      if (value[cursorPos]<'9') value[cursorPos]++;
      break;
    case btnDOWN:
      if (value[cursorPos]>'0') value[cursorPos]--;
      break;
    case btnSELECT: 
      lcd.print("Saved value: "); 
      //Serial.println(value);  
      cursorPos=0;
      lcd.clear();
      lcd.setCursor(0,1);
      lcd.print (value);
      MotorSpeed = atoi(value); // converts "value" into a double to be used as RPM speed
      
     
      break;
  }
   if (lcdNeedsUpdate) //continually refreshes the display as numbers are changed up and down
    {
      lcd.setCursor(0,1);
      lcd.print(value);
      lcd.setCursor(cursorPos,1);
      lcdNeedsUpdate=false;
    }
   
     return MotorSpeed;
    
     
 }

 // function for depth input from keypad
 double Input2(double Depth)
  { 
  char key=read_LCD_buttons();
  if (key!= btnNONE) lcdNeedsUpdate=true;

  switch (key) 
  {
    case btnRIGHT:
      if (cursorPos<2) cursorPos++;
      break;
    case btnLEFT:  
      if (cursorPos>0) cursorPos--;
     
      break;
    case btnUP:
      if (value[cursorPos]<'9') value[cursorPos]++;
      break;
    case btnDOWN:
      if (value[cursorPos]>'0') value[cursorPos]--;
      break;
    case btnSELECT: 
      lcd.print("Saved value: "); 
      //Serial.println(value);  
      cursorPos=0;
      lcd.clear();
      lcd.setCursor(0,1);
      lcd.print (value);
      Depth = atoi(value); // converts "value" into a double to be used as RPM speed
      
     
      break;
  }
   if (lcdNeedsUpdate) //continually refreshes the display as numbers are changed up and down
    {
      lcd.setCursor(0,1);
      lcd.print(value);
      lcd.setCursor(cursorPos,1);
      lcdNeedsUpdate=false;
    }
   
     return Depth;
     
     
 }

 //function for return speed from keypad
 double Input3 (double Reverse)
 {
   
  char key=read_LCD_buttons();
  if (key!= btnNONE) lcdNeedsUpdate=true;

  switch (key) 
  {
    case btnRIGHT:
      if (cursorPos<2) cursorPos++;
      break;
    case btnLEFT:  
      if (cursorPos>0) cursorPos--;
     
      break;
    case btnUP:
      if (value[cursorPos]<'9') value[cursorPos]++;
      break;
    case btnDOWN:
      if (value[cursorPos]>'0') value[cursorPos]--;
      break;
    case btnSELECT: 
      lcd.print("Saved value: "); 
      //Serial.println(value);  
      cursorPos=0;
      lcd.clear();
      lcd.setCursor(0,1);
      lcd.print (value);
      Reverse = atoi(value); // converts "value" into a double to be used as RPM speed
      
     
      break;
  }
   if (lcdNeedsUpdate) //continually refreshes the display as numbers are changed up and down
    {
      lcd.setCursor(0,1);
      lcd.print(value);
      lcd.setCursor(cursorPos,1);
      lcdNeedsUpdate=false;
    }
   
     return Reverse;
     
     
 }

Your post was from a while ago, I see that your code in "Setup" won't stop for input because you are incrementing "a" inside the while statement.

Did the shield you purchased come with a library or any example sketches?

A Menu system tutorial may be of some help. The heart of it is iterating through arrays.

dear all i want to program of sequential timer with 8 channel relay and lcd keypad shield. so i want to enter two value, one is off time (time between to relay become on) and on time(relay on time) by user and also can select millisecond, second, minibus or hour that also can be select by user.

i am not able to draw this program, can you please help me??/
can u give me the whole sours code.??

i an using arduino uno.

please help me.