sketch help

hi all

realy sorry for my stupidity 'but'

i have spent the last couple of weeks working on my (no previouse expience) programming i started with a sketch that would control my 4 motor chassis controlled wireless though apc220 rf modules which worked fine after a lot of tweeking, then i made another sketch to control the pan and tilt servos on the chassis again through the apc220 modules success again after much tweeking BUT when i combined the 2 sketches the motor control works perfectly but the pan and tilt centers and thats it i have no control of the pan and tilt servos the sketch is below. please be kind 8)

#include <Servo.h>

int minPulse1     =  0;      // minimum servo position
int maxPulse1     =  170;  // maximum servo position
int turnRate1     =  10;    // servo turn rate increment (larger value, faster rate)
int minPulse2     =  0;     // minimum servo position
int maxPulse2     =  180; // maximum servo position
int turnRate2     =  10;   // servo turn rate increment (larger value, faster rate)
int buttonPin     = 26;    // pin that the trigger will be connected to

int centerServo1;
int centerServo2;
int pulseWidth1;	    // servo pulse width
int pulseWidth2;	    // servo pulse width 

//motor control

int EN1 = 9;     //speed control
int EN2 = 11;   //speed control
int EN3 = 6;    //speed control
int EN4 = 10;  //speed control
int IN1 = 3;    //direction
int IN2 = 5;   //direction
int IN3 = 7;   //direction
int IN4 = 2;   //direction

void Motor1(int pwm, boolean reverse)
        {
          analogWrite(EN1,pwm); //set pwm control, 0 for stop, and 255 for maximum speed
         if(reverse)
         { 
          digitalWrite(IN1,HIGH);  
         }
        else
        {
          digitalWrite(IN1,LOW);    
         }
        }  
        
void Motor2(int pwm, boolean reverse)
        {
          analogWrite(EN2,pwm);
         if(reverse)
         { 
          digitalWrite(IN2,HIGH);    
         }
        else
        {
          digitalWrite(IN2,LOW);    
         }
        }  
void Motor3(int pwm, boolean reverse)
        {
          analogWrite(EN3,pwm); //set pwm control, 0 for stop, and 255 for maximum speed
         if(reverse)
         { 
          digitalWrite(IN3,HIGH);    
         }
        else
        {
          digitalWrite(IN3,LOW);    
         }
        }
void Motor4(int pwm, boolean reverse)
        {
          analogWrite(EN4,pwm); //set pwm control, 0 for stop, and 255 for maximum speed
         if(reverse)
         { 
          digitalWrite(IN4,HIGH);    
         }
        else
        {
          digitalWrite(IN4,LOW);    
         }
        }

Servo servo1;
Servo servo2;

void setup() {
  pinMode(buttonPin, OUTPUT);
  servo1.attach(22);
  servo2.attach(24);
  centerServo1 = maxPulse1 - ((maxPulse1 - minPulse1)/2);
  centerServo2 = maxPulse2 - ((maxPulse2 - minPulse2)/2);
  pulseWidth1 =  centerServo1;
  pulseWidth2 =  centerServo2;
  Serial.begin(9600);	// opens serial port, sets data rate to 9600 bps
  Serial.println("	Arduino Serial Servo Control");
  Serial.println("Press j, l, i, or k to move, spacebar to center, and f to fire");
  Serial.println();
  
  int i;
   
    for(i=2;i<=11;i++)       //Motor Shield pin settings
    pinMode(i, OUTPUT);  //set pin 2,3,5,6,7,9,10,11 to output mode

    //Serial.begin(9600);
}

void loop() {

  // check for serial input
  if (Serial.available() > 0) {

    int data = Serial.read();	         // read the incoming byte:
    digitalWrite(buttonPin, LOW);  // turn the pin off on any incoming data
    switch(data)
    {
    case 'j' :  
      pulseWidth1 = pulseWidth1 - turnRate1;  
      break;
    case 'l' :  
      pulseWidth1 = pulseWidth1 + turnRate1;  
      break ;
    case ' ' :  
      pulseWidth1 = pulseWidth2 = centerServo1;  
      break;
    case 'i' :  
      pulseWidth2 = pulseWidth2 - turnRate1;  
      break;
    case 'k' :  
      pulseWidth2 = pulseWidth2 + turnRate1;  
      break ;
    case 'f' :  
      digitalWrite(buttonPin, HIGH); 
      delay (1000); 
      digitalWrite(buttonPin, LOW); 
      break;

    }
    // stop servo pulse at min and max
    if (pulseWidth1 > maxPulse1) { 
      pulseWidth1 = maxPulse1; 
    }
    if (pulseWidth1 < minPulse1) { 
      pulseWidth1 = minPulse1; 
    }

    // stop servo pulse at min and max
    if (pulseWidth2 > maxPulse2) { 
      pulseWidth2 = maxPulse2; 
    }
    if (pulseWidth2 < minPulse2) { 
      pulseWidth2 = minPulse2; 
    }

    servo1.write(pulseWidth1);
    servo2.write(pulseWidth2);

    // print pulseWidth back to the Serial Monitor (uncomment to debug)
    Serial.print("Servo 1: ");
    Serial.print(pulseWidth1);
    Serial.print(" Servo 2: ");
    Serial.print(pulseWidth2);
    Serial.println("degrees");
    
    int x,delay_en;
  char val;
  while(1)
  {
    val = Serial.read();
    if(val!=-1)
       {
          switch(val)
           {
             case 'w'://Move ahead
                        Motor1(100,true);  //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor2(100,false);  //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor3(100,true); //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor4(100,false); //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                         break;
             case 'x'://move back
                        Motor1(100,false); //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor2(100,true); //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor3(100,false);  //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor4(100,true);  //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                         break;
             case 'a'://turn left
                        Motor1(100,true);  //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor2(100,true); //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor3(100,false);  //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor4(100,false); //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                         break;       
             case 'd'://turn right
                        Motor1(100,false); //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor2(100,false);  //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor3(100,true); //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        Motor4(100,true);  //adjust speed here 0 to 255 /adjust direction true=fowards false=reverse
                        break;   
               case 's'://stop
                        Motor1(0,false);
                        Motor2(0,false);
                        Motor3(0,false);
                        Motor4(0,false);
                         break;
                                  
           }     
        
       }
           
  }                           
}
  }

Using PWM and servos together can be tricky. There are a limited number of timers to go around. PWM needs one, to know when to change the duty cycle. The Servo library needs one to know when to refresh the servos.

Timers are tied to pins, too. You may be able to change which pins the servos are connected to, to find one that uses a different timer.

thanks for that didnt realize that will go back and tinker some more and see if i can move the servo pins about and see what happens

thanks for the help paul much appreciated

still having the same issues have full motor control but no servo control ??????????