serial data and LCD display

I am wanting to use one Arduino to request interger data from another then display that on a SMARTGPU LCD display. So I have the other Arduino set to transmitt a different data value depending on the value of the recieved inbyte.

I think I'm getting the basics down but I'm really not certain if this will work. Or if these is a simpler way to do it?

sample cut/paste from my code

      Serial.write(9);
      int rrin = Serial.read();
      char rightrin[2] = {rrin};
      
  // enter display data and screen positions
   lcd.string(224,34,255,65,BLACK,FONT7,TRANS,rightrin);

sample cut/paste from my code

We don't need to see snippets. We need to see ALL of your code. What does the sender look like?

      int rrin = Serial.read();
      char rightrin[2] = {rrin};

That is NOT how to convert an int to a char array. A char array needs to be large enough to hold the terminating NULL, too.

The itoa() function might be useful for you to look at. Or sprintf().

This is where I am as of now. I have to set the LCD positions still and add a few other features. I have a SMARTGPU on the way.

My display code, I'm working off of examples to try to learn it.

#include <SMARTGPU.h>     //include the SMARTGPU library!

SMARTGPU lcd;             //create our object called LCD

//Each time we use the touchscreen we must define a int array that stores the X and Y readed or touched coordinates.
int touch[2];
//Each time we use the touchicon we must define a char array that stores the name of the touched icon.
char icon[3];

char pixelArray[3];                     //Array to store the RGB888 pixel obtained with memoryRead()
#define ligBlue  0x96DD



//brightness function
void settings(){
  static int bright=127;                                       //Maximum bright is set by default  133 min 14
  static int buttonCen=271;                                    //button center, static variables to avoid losing the parameters even if we go to main menu
  
    lcd.imageSD(0,0,"Bright");                                 //Load image from SD card, image is 320x240(full screen) so we load it from top left corner X:0,Y:0   
    lcd.imageSD(0,0,"WinHead");                                //draw header
    
  while(1){   //Loop forever in the settings!    
    lcd.drawRectangle(40,64,(bright*2)+12,66,0x4C7C,FILL);     //draw brightness bar  266 max  40 min 
    lcd.drawRectangle((bright*2)+12,64,266,66,WHITE,FILL);     //fill the rest of the bar with white     
    lcd.imageSD((bright*2)+12,57,"button");                    //Load the button icon   266 max pos X, 40 min X pos   
    delay(100);                                                //delay to avoid fast change and flickering
    
    while(lcd.touchScreen(touch)==0 & lcd.touchIcon(icon)==0); //wait for a touch to do something
    if(lcd.touchIcon(icon)==1){                                //if the received touch was on any icon we exit go to main menu 
      break;  
    }
    
    //touch on Screen, change brightness and draw button icon
    if(touch[YCOORD]>55 & touch[YCOORD]<85 ){                  //if the previous touch was on active area
      lcd.imageSD((bright*2)+12,57,"clrBar");                  //clear the button icon       
           
      //check where to move left or right
      if(touch[XCOORD]>buttonCen){                             //if we need to move the bar to the right        
        bright+=10;                                            //increase the brightness
        buttonCen+=22;                                         //increase the center of the button
        if(bright>127){                                        //if the button reach the right corner
          bright=127;                                          //set maximum bright
          buttonCen=271;                                       //set maximum button center          
        }              
      }else{                                                   //move the bar to the left                                          
        bright-=10;                                            //decrease the brightness
        buttonCen-=22;                                         //decrease the center of the button
        if(bright<14){                                         //if the button reach the left corner
          bright=14;                                           //set minimum bright
          buttonCen=40;                                        //set minimum button center          
        }           
      }
      lcd.bright(bright);                                      //set new brightness value to SMART GPU          
    }
  } 
}



void setup() { 
  Serial.begin (9600);
  lcd.init();  //configure the serial and pinout of arduino board for SMARTGPU support
  lcd.start(); //initialize the SMARTGPU processor
  0x4F,01;
  lcd.setScreenBackground(ligBlue);
  lcd.imageSD(0,0,"splash"); //startup image
  delay (5000);

}


void loop() {
  
  unsigned char ic;
  
  while(1){
    //load Desktop
    lcd.imageSD(0,0,"Mainscreen");  
    ic=0;
    
    while(ic==0){      //loop until we get a click on one application 
      
      
      // read rpm and place on screen

    
      while(lcd.touchScreen(touch)==0);                              //Wait for touch
      if(touch[XCOORD]<70 & touch[YCOORD]> 8  & touch[YCOORD]< 230){ //If touch on menu
        ic=((touch[YCOORD]-8)/27)+1;                                 //divide (222pixels/8)=27 and add 1, to get the icon number
      }                                                              //else go back
    }                                 
   
    //begin application based on icon number  
    switch(ic){                 //now that we know a touch was made on a specified icon
      case 1:                  
        suspensionCom();
      break;             //end of case 2 suspension monitor
      
      case 2:        
        boomCom();  
      break;        //end of case 3 boom height control
      
      case 3:
        settings();  //brightness control
      break;
      
      default:                  //default for any other case
      break;                    //do nothing
    } 
  }  
}

// suspension data function
void suspensionCom() {// function name
    lcd.imageSD(0,0,"suspension"); //needs to be full screen bmp file
     while(1){   //Loop forever in suspension page
    while(lcd.touchScreen(touch)==0 & lcd.touchIcon(icon)==0); //wait for a touch to do something
    if(lcd.touchIcon(icon)==1){                                //if the received touch was on any icon we exit go to main menu 
      break;  
    }
    Serial.write (1);
       int lfpwm = Serial.read();
       char lfout[2] = {lfpwm};
    Serial.write (2);
       int rfpwm = Serial.read();
       char rfout[2] = {rfpwm};
    Serial.write (3);
       int lrpwm = Serial.read();
       char lrout[2] = {lrpwm};
    Serial.write (4);
       int rrpwm = Serial.read();
       char rrout[2] = {rrpwm};
    Serial.write (5);
       float manual = Serial.read();
       char manin[2] = {manual};
    Serial.write(6);
      int lfin = Serial.read();
      char leftfin[2] = {lfin};
    Serial.write(7);
      int rfin = Serial.read();
      char rightfin[2] = {rfin};
    Serial.write(8);
      int lrin = Serial.read();
      char leftrin[2] = {lrin};
    Serial.write(9);
      int rrin = Serial.read();
      char rightrin[2] = {rrin};
      
  // enter display data and screen positions
   lcd.string(224,34,255,65,BLACK,FONT7,TRANS,lfout);
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,rfout);
   lcd.string(224,34,255,65,BLACK,FONT7,TRANS,lrout);
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,rrout);
   lcd.string(224,34,255,65,BLACK,FONT7,TRANS,manin);
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,leftfin);
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,rightfin);
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,leftrin);
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,rightrin);

     }
}

// boom data function
void boomCom(){
 lcd.imageSD(0,0,"boom"); //needs full screen bmp file
  
 while(1){   //Loop forever in boom page
    while(lcd.touchScreen(touch)==0 & lcd.touchIcon(icon)==0); //wait for a touch to do something
    if(lcd.touchIcon(icon)==1){                                //if the received touch was on any icon we exit go to main menu 
      break;  
    }
    Serial.write (10);
       int leftpwm = Serial.read();
       char leftout[2] = {leftpwm}; 
    Serial.write (11);
       int cenpwm = Serial.read();
       char cenout[2] = {cenpwm};
    Serial.write (12);
       int rightpwm = Serial.read();
       char rightout[2] = {rightpwm};
    Serial.write (13);
       int leftsensor = Serial.read();
       char leftin[2] = {leftsensor};
    Serial.write (14);
       int centersensor = Serial.read();
       char centin[2] = {centersensor};
    Serial.write (15);
      int rightsensor = Serial.read(); 
      char rightin[2] = {rightsensor};
    Serial.write (16);
      int heightpot = Serial.read(); 
      char manpot[2] = {heightpot};
  
  // enter display data and screen positions
   lcd.string(224,34,255,65,BLACK,FONT7,TRANS,leftout);
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,cenout);
   lcd.string(224,34,255,65,BLACK,FONT7,TRANS,rightout);
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,leftin);
   lcd.string(224,34,255,65,BLACK,FONT7,TRANS,centin);
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,rightin); 
   lcd.string(80,36,100,55,BLACK,FONT0,TRANS,manpot);
}
}

I believe I will need to get an Arduino Mega to get multiple serial ports for the display module.

Sender code

const int n = 10;  //number of readings
 
int lfindex[n];      // the readings from the analog input
 int index = 0;                  // the index of the current reading
 int total = 0;                  // the running total
 int average = 0;                // the average
 
 int rfindex[n];                 
 int total1 = 0;
 int lrindex[n];        
 int total2 = 0;
int rrindex[n];     
 int total3 = 0;
 int index1 = 0;
int index2 = 0;
int index3 = 0;
int average1 = 0;
int average2 = 0;
int average3 = 0;

// pin assignments
int switchpin = 4;
int lfin = A0;
int rfin = A1;
int lrin = A2;
int rrin = A3;
int man = A4;
int lfout = 3;
int rfout = 5;
int lrout = 6;
int rrout = 9;


int switchstate;
int lfpwm = 0;
int rfpwm = 0;
int lrpwm = 0;
int rrpwm = 0;
int target = 520;
float manual;

void setup()
 {
 
   Serial.begin(9600);                   
 
  for (int thisReading = 0; thisReading < n; thisReading++)
  {
     lfindex[thisReading] = 0; 
     rfindex[thisReading] = 0;
     lrindex[thisReading] = 0;
     rrindex[thisReading] = 0;
  }
     
pinMode (lfout, OUTPUT);
pinMode (rfout, OUTPUT);
pinMode (lrout, OUTPUT);
pinMode (rrout, OUTPUT);
pinMode (switchpin, INPUT);
pinMode (lfin, INPUT);
pinMode (rfin, INPUT);
pinMode (lrin, INPUT);
pinMode (rrin, INPUT);
pinMode (man, INPUT);

     
 }

 
void loop() 
{
manual = analogRead(man) / 100.0; // operator input potentiomter
switchstate = digitalRead(switchpin); // operator on off switch
float rangehigh = target + (target * manual);
float rangelow = target - (target * manual);
float dzhigh = target + (target * .03);
float dzlow = target - (target * .03);

// left front control
  total= total - lfindex[index];          
   lfindex[index] = analogRead(lfin); 
   total= total + lfindex[index];         
   index = index + 1;                    
   if (index >= n)              
    index = 0;                           
   average = total / n; 
  
  if (average < rangelow) {
   lfpwm +=20; //increase fast
}
   else if (average > rangelow && average < dzlow){
   lfpwm ++;  //increase slow
} 
 if (average > rangehigh) {
    lfpwm -=20;  //decrease fast
}
   else if (average < rangehigh && average > dzhigh){
   lfpwm --;  //decrease slow
} 
 if (lfpwm > 253) {
  lfpwm = 253;}
 if (lfpwm < 1) {
  lfpwm = 1;}
 if (switchstate == LOW){
  lfpwm = 1;}  
 if (switchstate == HIGH) {
  analogWrite (lfout, lfpwm); 
  }
  
  //right front control
  total1= total1 - rfindex[index1];          
   rfindex[index1] = analogRead(rfin); 
   total1= total1 + rfindex[index1];         
   index1 = index1 + 1;                    
   if (index1 >= n)              
    index1 = 0;                           
   average1 = total1 / n; 
   
 if (average1 < rangelow) {
   rfpwm +=20; //increase fast
}
   else if (average1 > rangelow && average1 < dzlow){
   rfpwm ++;  //increase slow
} 
 if (average1 > rangehigh) {
    rfpwm -=20;  //decrease fast
}
   else if (average1 < rangehigh && average1 > dzhigh){
   rfpwm --;  //decrease slow
} 
 if (rfpwm > 253) {
  rfpwm = 253;}
 if (rfpwm < 1) {
  rfpwm = 1;}
 if (switchstate == LOW){
  rfpwm = 1;}   
 if (switchstate == HIGH)   {
   analogWrite (rfout, rfpwm);
   }
  
  //left rear control
   total2= total2 - lrindex[index2];          
   lrindex[index2] = analogRead(lrin); 
   total2= total2 + lrindex[index2];         
   index2 = index2 + 1;                    
   if (index2 >= n)              
    index2 = 0;                           
   average2 = total2 / n; 
  if (average2 < rangelow) {
   lrpwm +=20; //increase fast
}
   else if (average2 > rangelow && average2 < dzlow){
   lrpwm ++;  //increase slow
} 
if (average2 > rangehigh) {
    lrpwm -=20;  //decrease fast
}
   else if (average2 < rangehigh && average2 > dzhigh){
   lrpwm --;  //decrease slow
} 
 if (lrpwm > 253) {
  lrpwm = 253;}
 if (lrpwm < 1) {
  lrpwm = 1;}
 if (switchstate == LOW){
  lrpwm = 1;} 
 if (switchstate == HIGH)   {
  analogWrite (lrout, lrpwm);
  }
  
  // right rear control
  total3= total3 - rrindex[index3];          
   rrindex[index3] = analogRead(rrin); 
   total3= total3 + rrindex[index3];         
   index3 = index3 + 1;                    
   if (index3 >= n)              
    index3 = 0;                           
   average3 = total3 / n; 
 if (average3 < rangelow) {
   rrpwm +=20; //increase fast
}
   else if (average3 > rangelow && average3 < dzlow){
   rrpwm ++;  //increase slow
} 
  if (average3 > rangehigh) {
    rrpwm -=20;  //decrease fast
}
   else if (average3 < rangehigh && average3 > dzhigh){
   rrpwm --;  //decrease slow
} 
 if (rrpwm > 253) {
  rrpwm = 253;}
 if (rrpwm < 1) {
  rrpwm = 1;}
 if (switchstate == LOW){
  rrpwm = 1;} 
 if (switchstate == HIGH)  {
  analogWrite (rrout, rrpwm);
 }
 
  
  // serial data output
  if (Serial.available() > 0) 
  {
     int inByte = Serial.read();
 switch (inByte) {
     case 1:    
       Serial.write(lfpwm);
       break;
     case 2:    
       Serial.write(rfpwm);
       break;
     case 3:    
       Serial.write(lrpwm);
       break;
     case 4:    
       Serial.write(rrpwm);
       break;
     case 5:    
       Serial.write(manual);
       break;
     case 6:    
       Serial.write(average);
       break;
     case 7:
       Serial.write(average1);
       break;
     case 8:
       Serial.write(average2);
       break;
     case 9:
       Serial.write(average3);
       break;
 
 } 
  }
 
 }
  while(1){

Why? Why are you running an infinite loop inside an infinite loop()?

I have a SMARTGPU on the way.

Might I suggest that you wait for it to arrive.