int servo1Pin = 2;
int servo2Pin = 4;
int servo3Pin = 6;

int analogPin = 1;

int inc = 30;

long lastPulse1 = 0;
long lastPulse2 = 0;
long lastPulse3 = 0;

int refreshTime = 20;
int pulse1;
int pulse2;
int pulse3;
int analogVal;

void setup(){
Serial.begin(9600);
pinMode(servo1Pin, OUTPUT);
pinMode(servo2Pin, OUTPUT);
pinMode(servo3Pin, OUTPUT);
}

void loop(){

analogVal = analogRead(analogPin);
analogVal = int((analogVal/10.3));

if(analogVal >= 0 && analogVal < 25){
pulse1 = 2500;
pulse2 = (analogVal * 4) * 20 + 700;
pulse3 = 700;
}
if(analogVal >= 25 && analogVal < 50){
pulse1 = (100 - ((analogVal - 25) * 4)) * 20 + 700;
pulse2 = 2500;
pulse3 = 700;
}
if(analogVal >= 50 && analogVal < 75){
pulse1 = 700;
pulse2 = 2500;
pulse3 = ((analogVal - 50) * 4) * 20 + 700;
}
if(analogVal >= 75 && analogVal <= 100){
pulse1 = 700;
pulse2 = (100 - ((analogVal - 75) * 4)) * 20 + 700;
pulse3 = 2500;
}

/*pulse1 = 2200;
pulse2 = 1600;
pulse3 = 1000;

Serial.print(pulse1);
Serial.print("\t");
Serial.print(pulse2);
Serial.print("\t");
Serial.println(pulse3);*/

pulse1 = (2500 - (pulse1 - 700));
pulse2 = (2500 - (pulse2 - 700));
pulse3 = (2500 - (pulse3 - 700));

// pulse the servo again if rhe refresh time (20 ms) have passed:
if (millis() - lastPulse1 >= refreshTime) {
digitalWrite(servo1Pin, HIGH); // Turn the motor on
delayMicroseconds(pulse1);
digitalWrite(servo1Pin, LOW); // Turn the motor off
lastPulse1 = millis(); // save the time of the last pulse
}
if (millis() - lastPulse2 >= refreshTime) {
digitalWrite(servo2Pin, HIGH); // Turn the motor on
delayMicroseconds(pulse2);
digitalWrite(servo2Pin, LOW); // Turn the motor off
lastPulse2 = millis(); // save the time of the last pulse
}
if (millis() - lastPulse3 >= refreshTime) {
digitalWrite(servo3Pin, HIGH); // Turn the motor on
delayMicroseconds(pulse3);
digitalWrite(servo3Pin, LOW); // Turn the motor off
lastPulse3 = millis(); // save the time of the last pulse
}
}