OLED Wireless Display

I want to wirelessly receive the battery voltages from the receiver to my transmitter. I have the OLED installed on my transmitter section with the joystick along with Arduino and Radio-link connected via MAX232 IC. In my receiver section, there are motors with the 12 volts battery connected to the motors using an external radio module Radio Link Satel Satellite Radio 2ASXE. I already have running the motors successfully with commands as well as with the joystick using this radio-link. I have used MAX232 IC to interface the radio-link with the Arduino.

I want that when I wirelessly run the motors with the joystick, I would see the battery voltages on my OLED on my transmitter section.

I tried several times to make changes in the code but I could not succeeded.

Here is the code of my transmitter section via joystick.

int VRx=A1; // ANALOG READING FOR LEFT AND RIGHT MOVEMENT FOR X-AXIS
int VRy=A0; // ANALOG READING FOR UPWARD AND DOWNWARD MOVEMENT FOR Y-AXIS
int Sw=2; //
float Aval; //VALUE OF VOLTAGE AT A1PORT
float Bval; //VALUE OF VOLTAGE AT A0 PORT
unsigned int MAXIMUM = 1023; //MAXIMUM RESOLUTION
unsigned int MID = 512;
unsigned int MAX = 1023;

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH  16

#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif             // FUNCTION FOR THE OLED DISPLAY ENDS



void setup() {

Serial.begin(4800);
pinMode(VRx,INPUT);
pinMode(VRy,INPUT);
pinMode(Sw,INPUT);
//OLED SETUP
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  while (!Serial);
  display.display();
  display.clearDisplay();  // Clear the buffer.
}
 
void loop() {

 unsigned long tempA=0; // MOTOR A motor speed value start from zero
 unsigned long tempA1=0; //FORMULA
 unsigned long tempA2=0; //FORMULA
  Aval=analogRead(VRx);
 tempA = Aval;
 Serial.println (tempA);
 
 Serial.println(" JOYSTICK NEUTRAL POSITION");
 Serial.print("VRX: ");
 Serial.print(analogRead(VRx));
 Serial.print(" | ");
 Serial.print("VRY: ");
 Serial.print(analogRead(VRy));
 Serial.println(" | ");
 

 
 unsigned long tempB=0;  // MOTOR B motor speed value start from zero
 unsigned long tempB1=0; // Formula
 unsigned long tempB2=0; // Formula
 Bval=analogRead(VRy);
 tempB = Bval;
 Serial.println (tempB);

 

 //FORWARD DONE SUCCESSFULLY
 //===========================================================================//
 if ((tempB>550) && (tempA>450 && tempA<550)){                     
  tempB1 = (((tempB-MID)*100)/MID);
  char st[20]; // Send command to the buffer Vx as a statement for motor A
  char st1[20]; // Send command  Vy as a statement for motor B
 sprintf(st,"<A+%03lu>",tempB1);
 sprintf(st1,"<B+%03lu>",tempB1);
 Serial.println (st);
 Serial.println (st1);
}


 //BACKWARD DONE SUCCESSFULLY
 //===========================================================================//
 if ((tempB<450) && (tempA>450 && tempA<550)){                     
 tempB1= (((MID - tempB)*100)/MID);
  char st[20];
  char st1[20];
 sprintf(st,"<A-%03lu>",tempB1);
 sprintf(st1,"<B-%03lu>",tempB1);
 Serial.println (st);
 Serial.println (st1);

 }

 //NEUTRAL DONE SUCCESSFULLY
 //===========================================================================//
 if ((tempB>450 && tempB<550) && (tempA>450 && tempA<550)){         
  char st[20];
 Serial.println ("<A+000>");
 Serial.println ("<B+000>");
  }

//PURE LEFT MOVEMENT MOTOR // DONE SUCCESSFULLY
//===========================================================================//
if ((tempA<450) && (tempB>450 && tempB<550)){ 
  tempA1=(((MID-tempA)*100)/MID);                
 char st[20];
 char st1[20];
 sprintf(st1,"<B+%03lu>",tempA1);
 Serial.println (st1);
 }

 //PURE RIGHT MOVEMENT MOTOR // DONE SUCCESSFULLY
//===========================================================================//
 if ((tempA>550) && (tempB>450 && tempB<550))
  {
    tempA1 = (((tempA-MID)*100)/MID);
    
  char st[20];
 char st1[20];
 sprintf(st,"<A+%03lu>",tempA1);
 Serial.println (st);
 }


// FORWARD RIGHT MOVEMENT BOTH MOTORS; LEFT MOTOR SPEED IS HIGH AND RIGHT MOTOR SPEED IS LOW //DONE SUCCESSFULLY
//=============================================================================================================//
 if ((tempA>550) && tempB>550)
  {                                                           
  tempA1 = ((tempB * 100)/MAX);
  tempB1 = (((tempA - MID)*100)/(MAX - MID));
  tempB2 = (tempA1 -  ((tempB1 * tempA1)/100));  
  char st[20];
  char st1[20];
 sprintf(st,"<A+%03lu>",tempA1);
 sprintf(st1,"<B+%03lu>",tempB2);
 Serial.println (st);
 Serial.println (st1);
 }

// FORWARD LEFT MOVEMENT BOTH MOTORS; LEFT MOTOR SPEED IS LOW AND RIGHT MOTOR SPEED IS HIGH //DONE SUCCESSFULLY
  //==========================================================================================================//
 if ((tempA<450) && (tempB>550))
 { 
  tempB1=((tempB * 100)/ MAX );                         
  tempA1 = (100 - ((tempA * 100)/(MID)));
  tempA2 = (tempB1 -  ((tempA1 * tempB1)/100));
  char st[20];
  char st1[20];
 sprintf(st,"<A+%03lu>",tempA2);
 sprintf(st1,"<B+%03lu>",tempB1);
 Serial.println (st);
 Serial.println (st1);

 }



// REVERSE RIGHT MOVEMENT BOTH MOTORS; LEFT MOTOR SPEED IS HIGH (MOVING ANTICLOCKWISE) AND RIGHT MOTOR SPEED IS LOW (MOVING CLOCKWISE)
//====================================================================================================================================//

if (tempA>550 && tempB<450)
  {                                          
  tempA1 = (((MID - tempB) * 100) / (MID) );
  tempB1 = (((tempA - MID)*100)/(MAX - MID));
  tempB2 = (tempA1 - ((tempB1 * tempA1)/100 ));
  char st[20];
  char st1[20];
 sprintf(st,"<A-%03lu>",tempA1);
 sprintf(st1,"<B-%03lu>",tempB2);
 Serial.println (st);
 Serial.println (st1);

 }


// REVERSE LEFT MOVEMENT BOTH MOTORS; LEFT MOTOR SPEED IS LOW (MOVING CLOCKWISE) AND RIGHT MOTOR SPEED IS HIGH (MOVING ANTICLOCKWISE)
// ===================================================================================================================================//

 if (tempA<450 && tempB<450)                    
  {                                                            
  
  tempB1= (((MID - tempB) * 100)/(MID));
  tempA1= (100 - ((tempA * tempB1)/(MID)));
  tempA2= (tempB1 - ((tempA1 * tempB1)/100));
  char st[20];
  char st1[20];
 sprintf(st,"<A-%03lu>",tempA2);
 sprintf(st1,"<B-%03lu>",tempB1);
 Serial.println (st);
 Serial.println (st1);

 }



 
// delay(1000);
}

void displayVoltage(double Voltage) // i chaned the small v into Captial V for Voltages because V is capital on my receiver of the code .. but still it didnot work
 {                                  // no display on OLED
while (Serial.available()) //even i tried to include this one while (Serial.available())
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(28, 18);
display.print ("Voltage:");
display.print (Voltage);
display.println("V");
display.display();
  
  }

Here is the code of the receiving section:

#include <Servo.h>
const int m_1 = 5;
const int m_2 = 6;
const int LED = 13;
String strID = "";
String GPSmessage = "";
String DEPmessage = ""; // message buffer
bool msgEOL = false; // EOL flag
bool depEOL = false;
int BaudRate = 4800;
Servo ESC_1; // create servo object to control the ESC 1
Servo ESC_2; // create servo object to control the ESC 2
#define FWD 0
#define BWD 1

unsigned long TimeoutTimer = 0;


String message; //to store messages written in serial monitor

// FUNCTION FOR THE OLED DISPLAY
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH  16
static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000
};

#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif             // FUNCTION FOR THE OLED DISPLAY ENDS




//BATTERY READINGS VARIABLES
const int Battery = A0;
float Voltage = 0.0; //input battery voltage
float Voltage1 = 0.0; //output voltage for analog pin A0
float R1 = 1590; // R1 =47k ohms and 27k ohms resistors
float R2 = 1000; // R2 =10k ohms resistor 
int readValue = 0;
long previousMillis_battery = 0;
byte Bat_start_timer = 0;
int battery_wait;
unsigned long currentMillis = 0; // VALID FOR ALL FUNCTIONS(COUNTER)

//BATTERY FUNCTION
void battery()
{
 readValue = analogRead(Battery);
 Voltage1 = readValue * (5.0 / 1023.0); 
 Voltage = Voltage1 / (R2/(R1+R2));
 if(Bat_start_timer == 0) battery_wait = 2000;
 if(currentMillis - previousMillis_battery > battery_wait) {
  Serial.println("$ABC,"); Serial.print(Voltage); Serial.print(",V,");
  previousMillis_battery = currentMillis;
    battery_wait = 2000; Bat_start_timer = 1; }

} // battery FUNCTION END

unsigned int FORWARD = 2000;
unsigned int NEUTRAL = 1500;
unsigned int REVERSE = 1000;

unsigned int APwm = NEUTRAL;
unsigned int BPwm = NEUTRAL;

boolean ADirection = FWD;
boolean BDirection = FWD;
unsigned int AVelocity = 0; // CURRENT VELOCITY OF M1 in 0-100%
unsigned int BVelocity = 0; // CURRENT VELOCITY OF M2 in 0-100%

String inputString = "";
int TaskNumber = 0;

uint32_t msgTimeout = 0ul;
uint32_t timeNow;

unsigned int GetValue(void)// fetch three digit number value from received string and convert to INTEGER
{
  unsigned int Val = 0;
  Val = (inputString[3] - 48) * 100;
  Val = Val + (inputString[4] - 48) * 10;
  Val = Val + (inputString[5] - 48);
  return (Val);
}






void setup()
{
  Serial.begin(BaudRate); //RX0 for radiolink controlling two motors
  Serial1.begin(BaudRate); // gps sensor port
  Serial2.begin(BaudRate); // dep sensor port
  GPSmessage.reserve(100); // reserve 100 bytes for the GPSmessage:
  ESC_1.attach(m_1);// (pin, min pulse width, max pulse width in microseconds)
  ESC_2.attach(m_2);// (pin, min pulse width, max pulse width in microseconds)
  pinMode(LED, OUTPUT);
  pinMode(Battery, INPUT);
  Serial.println("ABC System Started");
  ESC_1.writeMicroseconds(APwm);
  ESC_2.writeMicroseconds(BPwm);

//OLED SETUP
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  // init done
  // Show image buffer on the display hardware.
  // Since the buffer is intialized with an Adafruit splashscreen
  // internally, this will display the splashscreen.
  display.display();
    delay(2000);

  display.clearDisplay();  // Clear the buffer.
}




boolean AFwdFlag = 0; //makes sure that the serial only prints once the state
boolean BFwdFlag = 0; //makes sure that the serial only prints once the state




void loop()
{

    currentMillis=millis(); // to monior voltages on a serial monitor
    battery();  // battry function recall
 
    //display OLED Voltages on a screen
    Serial.print(Voltage); Serial.print(",V,");
    display.clearDisplay();

    display.setTextSize(1.5);
    display.setTextColor(WHITE);
    display.setCursor(1, 4);
    display.println("ABC System Started");

    
    display.setTextSize(2);
    display.setTextColor(WHITE);
    display.setCursor(28, 18);
    display.print (Voltage);
    display.println("V");
    display.display();
  
  
  
  
  
  timeNow = millis();
  
  
serialEvent();


if( TaskNumber == 0 )
    {
        //if we've gone 5-seconds...
        if( (timeNow - msgTimeout) >= 5000ul )
        {
            //then all stop
            ESC_1.writeMicroseconds(NEUTRAL); 
            ESC_2.writeMicroseconds(NEUTRAL); 
            digitalWrite(LED, HIGH );  //<---- add this line

        }//if
        
    }//if

if( TaskNumber )
    {
        //each pass where we see a non-zero task #, reset the msgTimeout value
        msgTimeout = millis();
        digitalWrite(LED, LOW );  

  if(TaskNumber==1) Serial.println("OK");
  if(TaskNumber==2 || TaskNumber==4) {ESC_1.writeMicroseconds(NEUTRAL); }
  if(TaskNumber==3 || TaskNumber==4) {ESC_2.writeMicroseconds(NEUTRAL);}
  if(TaskNumber==5 || TaskNumber==7) {
                      if(ADirection==FWD) { APwm= NEUTRAL + (((FORWARD-NEUTRAL)/100)*AVelocity); ESC_1.writeMicroseconds(APwm); AFwdFlag=1; }
                      else {
                              if(AFwdFlag==1)
                               {
                                ESC_1.writeMicroseconds(NEUTRAL);delay(100);
                                ESC_1.writeMicroseconds(REVERSE);delay(100); 
                                ESC_1.writeMicroseconds(NEUTRAL);delay(100);
                                AFwdFlag=0;
                               } 
                              APwm= NEUTRAL - (((NEUTRAL-REVERSE)/100)*AVelocity); ESC_1.writeMicroseconds(APwm);  
                           }
                     } 


  if(TaskNumber==6 || TaskNumber==7) {
                      if(BDirection==FWD) { BPwm= NEUTRAL + (((FORWARD-NEUTRAL)/100)*BVelocity); ESC_2.writeMicroseconds(BPwm); BFwdFlag=1; }
                      else {
                              if(AFwdFlag==1)
                               {
                                ESC_2.writeMicroseconds(NEUTRAL);delay(100);
                                ESC_2.writeMicroseconds(REVERSE);delay(100); 
                                ESC_2.writeMicroseconds(NEUTRAL);delay(100);
                                BFwdFlag=0;
                               } 
                              BPwm= NEUTRAL - (((NEUTRAL-REVERSE)/100)*BVelocity); ESC_2.writeMicroseconds(BPwm);  
                           }
                     } 

 
  TaskNumber=0;
  
}


}//SHOULD END HERE




// <AN> <A+xxx> <A-xxx>
// <BN> <B+xxx> <B-xxx>
// <CN> <C+xxx> <C-xxx>

void serialEvent() { //radiolink for controlling two motors by command Serial port 0 

  while (Serial.available()) {

    char inChar = (char)Serial.read();
    inputString += inChar;

    if (inChar == '\r' || inChar == 10)
    {
      
      if(inputString[0]=='<') 
      {

        if(inputString[1]=='A' && inputString[2]=='T' && inputString[3]=='>' ) TaskNumber=1; // AT

        if(inputString[2]=='N' && inputString[3]=='>' )
        {
          if ( inputString[1] == 'A') TaskNumber = 2; // Set Motor A to Neutral
          if ( inputString[1] == 'B') TaskNumber = 3; // Set Motor B to Neutral
          if ( inputString[1] == 'C') TaskNumber = 4; // Set Both Motors to Neutral
        }
    
        if(inputString[6]=='>' )
        {
          
          if ( inputString[1] == 'A') { 
            if(inputString[2]=='+') ADirection=FWD; else ADirection=BWD; 
            AVelocity=GetValue(); 
            TaskNumber=5;
          }  
          
          if ( inputString[1] == 'B') { 
            if(inputString[2]=='+') BDirection=FWD; else BDirection=BWD; 
            BVelocity=GetValue(); 
            TaskNumber=6;
          }  
                    
          if ( inputString[1] == 'C'){ 
            if(inputString[2]=='+') { ADirection=FWD; BDirection=FWD;} 
            else {ADirection=BWD; BDirection=BWD;} 
            AVelocity=GetValue();
            BVelocity=GetValue(); 
            TaskNumber=7;
          }  
          
        }
  
      }
      inputString = "";
    }
  }
}

Im using an OLED with the pins Vcc, GND, SCL and SDA

Where is the code that transmits the data?

I need to receive the voltage data from the receiver and show on OLED which is at transmitter section.

Please see the code above ...