Sending Mutiple Data Vaules from an HC-05 module to and HC-06 module

My goal is to send two potentiometer values across from one Arduino to another. I have had trouble finding a way to do this easily with my research online, and I have had little success in accomplishing this on my own.

I tried to send the potentiometer data only when it’s value had changed, so that only one potentiometer value would be sent at a time. Unfortunately this did not work, and I need some assistance in devising a solution to this problem. Thank you in advance for your time and effort.

This is my latest attempt:

Transmitter Code:

#include <Servo.h>
int servoPin = 2;
#define TOLERANCE 6
#define TOLERANCE2 6

int servo1Pos = 0;
int servo2Pos = 0;

int potVal1 = 0;
int potVal2 = 0;

int potPin1 = 2;
int potPin2 = 3;

int prevServo1Pos = servo1Pos - 1;
int prevServo2Pos = servo2Pos - 1;

int A;
int B;

Servo servo;

void setup() {
Serial.begin(38400);
servo.attach(servoPin);
}

void loop() {
if(Serial.available() > 0){

potVal1 = analogRead(potPin1);
servo1Pos = potVal1/6;
potVal2 = analogRead(potPin2);
servo2Pos = potVal2/6;

int diffPot1 = abs(servo1Pos - prevServo1Pos);

if(diffPot1 > TOLERANCE){
Serial.write(A);
prevServo1Pos = servo1Pos;
//Serial.println(“Servo Pos 1 Sent”);
//Serial.println(servo2Pos);
}

int diffPot2 = abs(servo2Pos - prevServo2Pos);

if(diffPot2 > TOLERANCE2){
Serial.write(B);
prevServo2Pos = servo2Pos;
//Serial.println(“Servo Pos 2 Sent”);
//Serial.println(servo2Pos);
}
}

}

Receiver Code:

#include <Servo.h>
#define TOLERANCE 6

int servo1Pos;
int servo2Pos;
int potVal= 0;

int prevServo1Pos = servo1Pos - 1;
int prevServo2Pos = servo2Pos - 1;
int A;
int B;

Servo servo;
Servo servo2;

void setup() {
Serial.begin(38400);
servo.attach(2);
servo2.attach(3);
}

void loop() {
if(Serial.available() > 0) {
A = Serial.read(); //checks if data is available
B = Serial.read();
}

Serial.println(“Servo Pos 1:”);
Serial.println(A);
Serial.println("");

Serial.println(“Servo Pos 2:”);
Serial.println(B);
delay(1000);

}

Why does sending the data depend on their being data to read? Why don't you read the data that is available to be read?

On the receiver, if there is one byte available to be read, it is NOT OK to read two values.