16x2 lcd print only 1 character

hi everyone

i’m working on project to display number using button. in this project i use two arduino mega where one for execute the arithmetic operation and another one for display. right now i’m at where i want to display number until 99. but i face a problem where lcd only display one digit. does anybody know what is the problem i am facing right now? and will be gratefull for the solution
here i attach the source code for both arithmetic and the for the lcd

int button1= 22;
int button2= 23;
int button3= 24;
int button4= 25;
int button5= 26;
int button6= 27;
int button7= 28;
int button8= 29;
int button9=30;
int button10=31;
int tambah=0;
int jawapan;
int baca;
int hantar;
int a;
int b;
int c;
int d;
int e;
int f;
int g;
int h;
int i;
int j;

unsigned char usButtonStatus(void);
 

void setup()
{
  Serial.begin(9600);
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  pinMode(button3, INPUT);
  pinMode(button4, INPUT);
  pinMode(button5, INPUT);
  pinMode(button6, INPUT);
  pinMode(button7, INPUT);
  pinMode(button8, INPUT);
  pinMode(button9, INPUT);
  pinMode(button10,INPUT);
  pinMode(tambah, INPUT);

// Serial.print (hantar);
// delay (10000);
}


void loop()
{
  baca:
  

if (digitalRead(button1)==HIGH);
  {
   a = 0;
   delay(10);
   
  }
  
 if (digitalRead(button1)==LOW)
 {
  a=5;
 delay(10);

 
 }
 if (digitalRead (button2) ==LOW && digitalRead (button3)==HIGH && digitalRead (button4)== HIGH && digitalRead(button5)==LOW)
 {
  b = 1;
  c =0;
  d=0;
  e=0;
  delay(10); 
 }
 
 if (digitalRead (button2)==LOW && digitalRead (button3) == LOW  && digitalRead (button4)==HIGH && digitalRead (button5)==HIGH)
 {
  b=1 ;
  c=1;
  d=0;
  e=0;
 delay(10); 
 }
 
 
 if (digitalRead (button2)==LOW && digitalRead (button3) == LOW  && digitalRead (button4)==LOW && digitalRead (button5)==HIGH)
 {
  b=1;
 c=1 ;
  d=1;
  e=0;
 delay(10); 
 }
 
 
 if (digitalRead (button2)==LOW && digitalRead (button3) == LOW  && digitalRead (button4)==LOW && digitalRead (button5)==LOW)
 {
  e=1;
  b=1;
  c=1;
  d=1;
  
 delay(10); 
 }
 
 if(digitalRead (button2)==HIGH && digitalRead(button3)==HIGH && digitalRead(button4)==LOW && digitalRead(button5)==LOW)
 {
   e=0;
   b=0;
   c=0;
   d=0;
 }
 
 if (digitalRead(button6)==LOW)
 {
   f = 50;
   delay(10);
 }
 if (digitalRead(button6)==HIGH)
 {
  f=0;
 delay(10); 
 }
 
 if(digitalRead(button7)==LOW && digitalRead(button8)==HIGH && digitalRead(button9)==HIGH && digitalRead(button10)==HIGH)
 {
   g=10;
   h=0;
   i=0;
   j=0;
   delay(10);
 }
 
 if(digitalRead(button7)==LOW && digitalRead(button8)==LOW && digitalRead(button9)==HIGH && digitalRead(button10)==HIGH)
 {
   g=10;
   h=10;
   i=0;
   j=0;
   delay(10);
 }
 
  if(digitalRead(button7)==LOW && digitalRead(button8)==LOW && digitalRead(button9)==LOW && digitalRead(button10)==HIGH)
 {
   g=10;
   h=10;
   i=10;
   j=0;
   delay(10);
 }
 
 if(digitalRead(button7)==LOW && digitalRead(button8)==LOW && digitalRead(button9)==LOW && digitalRead(button10)==LOW)
 {
   g=10;
   h=10;
   i=10;
   j=10;
   delay(10);
 }




jawapan:
   
   hantar=a+b+c+d+e+f+g+h+i+j;
    delay (10);
   
 
// else 
// {
//   a = 0;
// delay (1000);
//
// } s

//while (digitalRead(tambah)==LOW)


if(usButtonStatus()==1)
{
  Serial.print (hantar);
 delay (10000);
}

 //goto baca;
// if (digitalRead(tambah)== LOW)
 //{ 
  //goto jawapan; 
 //}
 //if(digitalRead (tambah)==HIGH)
 //{
  // goto baca;   
 //}
 //if(digitalRead (tambah)==LOW)
 //{
  //goto jawapan; 
 //}
 } 
 
 unsigned char usButtonStatus(void)
 {
   unsigned char nstatus = 0;
   unsigned char button_status = 0;
   
   if(digitalRead(10) == 1)
   {
       do
       {
         nstatus = digitalRead(10);
         button_status = 1;
       }while(nstatus); 
   }
   
   return button_status;
   
   
   
   
 }
// include the library code:
#include <LiquidCrystal.h>
//int button=22;

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup(){
    // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // initialize the serial communications:
  Serial.begin(9600);
//  pinMode(button,INPUT);
}

void loop()


{
//  while (digitalRead (button)==LOW);
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(500);
    // clear the screen
    lcd.clear();
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd.write(Serial.read());
      Serial.println(Serial.read());
    }
  }
}

I have no idea what you are sending to the display, but there is a bug in the receiving code.

lcd.write(Serial.read());
 Serial.println(Serial.read());

The two Serial.read () calls print every other character to the lcd. The serial monitor gets the missing ones.

You can replace it with something like

char val = Serial.read();
           lcd.write(val);
          Serial.println(val);

With this substitution, everything I type in the entry box of the monitor shows up in both places.

First my question is why you are using 2 arduino mega ?? It has more efficient digital ios to achieve using 1 mega board itself.

2) Send me your connection Diagram,

cattledog: I have no idea what you are sending to the display, but there is a bug in the receiving code.

lcd.write(Serial.read());
 Serial.println(Serial.read());

The two Serial.read () calls print every other character to the lcd. The serial monitor gets the missing ones.

You can replace it with something like

char val = Serial.read();
           lcd.write(val);
          Serial.println(val);

With this substitution, everything I type in the entry box of the monitor shows up in both places.

great eyes you have. and yes it work. thank you very much