Displaying values on LCD

Good day everyone! I was wondering on how can i display 2 or more numbers on the lcd. Currently with my code i can only display one value. All help is greatly apprecaited!

  char key = keypad.getKey ();
  if (key != NO_KEY)
  {
    key = key - 48 ;
    myValue = ( myValue * 10 ) + key ; //ASCII values 

    lcd.setCursor(0, 0);
    lcd.write (myValue);
    lcd.display();
    Serial.println( ) ;
  }

Hi,
You will have to post you complete code please.

Tom… :slight_smile:

lcd.setCursor(0, 0);
lcd.print (myValue);
lcd.print(" - "); //Print a separator.
lcd.print (myValue);

Now myValue is shown twice on the display.

Not sure if this is what you want, but it is the answer to what you ask.

TomGeorge:
Hi,
You will have to post you complete code please.

Tom… :slight_smile:

hi! thanks, i will post it here :

#include <LiquidCrystal.h>
#include <Keypad.h>
const byte rows = 4; //four rows
const byte cols = 3; //three columns
char keys[rows][cols] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
};
byte rowPins[rows] = {22, 24, 26, 28}; //connect to the row pinouts of the keypad left first 4
byte colPins[cols] = {30, 32, 34 }; //connect to the column pinouts of the keypad right last 3
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );
const int rs = 2, en = 3, d4 = A7, d5 = A8, d6 = A9, d7 = A10;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int myValue = 0 ;
int i;
int sensor1 = A1;
int sensor1val;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  lcd.begin(16, 2);
  pinMode(sensor1, INPUT_PULLUP);
}

void loop() {
  // put your main code here, to run repeatedly:
  lcd.setCursor(0, 0);
  lcd.write ("Welcome!");
  lcd.display();
  lcd.setCursor(0, 1);
  lcd.write("Select item no.");
  lcd.display();
  char key = keypad.getKey ();
  if (key == '1')
  {
    lcd.clear();
    delay(500);
    lcd.setCursor(0, 0);
    lcd.write( "You selected");
    lcd.display();
    lcd.setCursor(0, 1);
    lcd.write("Item 1");
    lcd.display();
    delay(1000);
    lcd.clear();
    sensor1val = digitalRead(sensor1);
    while (sensor1val == HIGH)
    {
      lcd.setCursor(0, 0);
      lcd.write(" Processing.... ");
      lcd.display();
      //conveyor on here
      sensor1val = digitalRead(sensor1);
    }
    sensor1val = digitalRead(sensor1);
    while (sensor1val == LOW)
    {
      //conveyour stop
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.write("Enter weight");
      lcd.display();
      lcd.setCursor(0, 1);
      char key = keypad.getKey ();
      if ( key != NO_KEY)
      {
        key = key - 48;
        myValue = ( myValue * 10 ) + key ;
        lcd.print(myValue);
        lcd.display();
        while (1)
        {
        }
      }
    }

  }

For now, if i enter anything on the keypad, The lcd displays something that cannot be read. All help is greatly appreciated!

Plus a detailed, unambiguous description of what it does, and what you want it to do.