Controlling 2 servos opposite way

Hi,
Can someone help me with code. I'm stuck in this situation of controlling 2 servo opposite way.
I'm controling it throu the bluetooth app. So its changing degrees in -+1 degree.
I'm trying to make robotic arm. So in this situation I'm trying that 2 servo work like 1 servo.
For example like "servoleft" and "servoright".


#include <SoftwareSerial.h>
#include <Servo.h>
Servo servo01;
Servo servo02;

SoftwareSerial Bluetooth(3, 2); // Arduino(RX, TX) - HC-05 Bluetooth (TX, RX)
int servo1Pos, servo2Pos; // current position
int servo1PPos, servo2PPos; // previous position
int servo01SP[50], servo02SP[50]; // for storing positions/steps
int speedDelay = 20;
int index = 0;
int b;
int c;
String dataIn = "";
void setup() {
servo01.attach(4);
servo02.attach(5);
Serial.begin(9600);

Bluetooth.begin(9600); // Default baud rate of the Bluetooth module
Bluetooth.setTimeout(1);
delay(20);
// Robot arm initial position
servo1PPos = 84;
servo2PPos = 80;
servo01.write(servo1PPos);
servo02.write(servo2PPos);

}
void loop() {
// Check for incoming data
if (Bluetooth.available() > 0) {
dataIn = Bluetooth.readString(); // Read the data as string

// If "Waist" slider has changed value - Move Servo 1 to position
if (dataIn.startsWith("s6")) {
String dataInS = dataIn.substring(2, dataIn.length());
servo1Pos = dataInS.toInt();
if (servo1PPos > servo1Pos) {
for ( int j = servo1PPos; j > servo1Pos; j -= 1) { // Run servo down
servo01.write(j);
delay(5);
servo02.write(0 + j);
delay(30); // defines the speed at which the servo rotates
}
}
// If previous position is smaller then current position
if (servo1PPos < servo1Pos) {
for ( int j = servo1PPos; j < servo1Pos; j += 1) { // Run servo up
servo01.write(j);
delay(5);
servo02.write(155 - j);
delay(30);
}
}
servo1PPos = servo1Pos; // set current position as previous position
}


Controlling "2 servos opposite way" doesn't mean very much. It's normally just write(x) to one, write(180-x to the other. But I don't think that's what you mean.

Perhaps you could give a few examples. E.g. servo1 goes to 30, servo2 goes to ?. The code doesn't help much. It never makes any use of servo2Pos or servo2PPos so I can't tell what's supposed to be happening.

So in some detail please, what does the code do now and what should it do that's different?

Steve

Read the how get the most out of this forum sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.