combing codes

i need help in combining two codes

FIRST
///////
#include <SoftwareSerial.h> // TX RX software library for bluetooth
#include <Servo.h> // servo library
Servo myservo1, myservo2, myservo3, myservo4; // servo name
int bluetoothTx = 0; // bluetooth tx to 10 pin
int bluetoothRx = 1; // bluetooth rx to 11 pin
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
myservo1.attach(8); //gripper
myservo2.attach(11);
myservo3.attach(12); //right
myservo4.attach(13); //left
//Setup usb serial connection to computer
Serial.begin(9600);
//Setup Bluetooth serial connection to android
bluetooth.begin(9600);
}
void loop()
{
//Read from bluetooth and write to usb serial
if(bluetooth.available()>= 2 )
{
unsigned int servopos = bluetooth.read();
unsigned int servopos1 = bluetooth.read();
unsigned int realservo = (servopos1 *256) + servopos;
Serial.println(realservo);
if (realservo >= 1000 && realservo <1180) {
int servo1 = realservo;
servo1 = map(servo1, 1000, 1180, 0, 180);
myservo1.write(servo1);
Serial.println(“Servo 1 ON”);
delay(10);
}
if (realservo >= 2000 && realservo <2180) {
int servo2 = realservo;
servo2 = map(servo2, 2000, 2180, 0, 180);
myservo2.write(servo2);
Serial.println(“Servo 2 ON”);
delay(10);
}
if (realservo >= 3000 && realservo <3180) {
int servo3 = realservo;
servo3 = map(servo3, 3000, 3180, 0, 180);
myservo3.write(servo3);
Serial.println(“Servo 3 ON”);
delay(10);
}
if (realservo >= 4000 && realservo <4180) {
int servo4 = realservo;
servo4 = map(servo4, 4000, 4180, 0, 180);
myservo4.write(servo4);
Serial.println(“Servo 4 ON”);
delay(10);
}
}
}

///////////////
SECOND
//////////////
#include <AFMotor.h>

AF_DCMotor motor1(1);
AF_DCMotor motor2(2);

char dataIn=‘S’;char determinant;char det;int vel = 0;int overdrive = 13;

void nav (int spd,int spd2){motor1.setSpeed(spd2);motor1.run(FORWARD); //MOTOR 1
motor2.setSpeed(spd);motor2.run(FORWARD);} // MOTOR 2

void rev (int spd2,int spd){motor1.setSpeed(spd2);motor1.run(BACKWARD); //MOTOR 1
motor2.setSpeed(spd);motor2.run(BACKWARD);} // MOTOR 2

void setup(){

Serial.begin(9600);
Serial.begin(9600);

pinMode(overdrive, OUTPUT);
}

void loop(){

det = check();

while (det == ‘F’) // F, move forward
{nav(vel,vel);det = check();}

while (det == ‘B’) // B, move back
{rev(vel,vel);det = check();}

while (det == ‘R’) // L, move wheels left
{nav(vel/4,vel);det = check();}

while (det == ‘L’) // R, move wheels right
{nav(vel,vel/4);det = check();}

while (det == ‘J’) // I, turn right forward
{nav(vel,vel/2);det = check();}

while (det == ‘I’) // J, turn right back
{rev(vel,vel/4);det = check();}

while (det == ‘H’) // G, turn left forward
{nav(vel/2,vel);det = check();}

while (det == ‘G’) // H, turn left back
{rev(vel/4,vel);det = check();}

while (det == ‘S’) // S, stop
{nav(0,0);det = check();}

//---------------------Toggle switch code------------------//
/* while (det == ‘U’)
{digitalWrite(power, HIGH);det = check();}
while (det == ‘u’)
{digitalWrite(power, LOW);det = check();}*/
//---------------------Mains Power------------------//
while (det == ‘W’)
{digitalWrite(overdrive, HIGH);det = check();}
while (det == ‘w’)
{digitalWrite(overdrive, LOW);det = check();}

}

int check()
{if (Serial.available() > 0) {dataIn = Serial.read();
if (dataIn == ‘F’){determinant = ‘F’;}
else if (dataIn == ‘B’){determinant = ‘B’;}else if (dataIn == ‘L’){determinant = ‘L’;}
else if (dataIn == ‘R’){determinant = ‘R’;}else if (dataIn == ‘I’){determinant = ‘I’;}
else if (dataIn == ‘J’){determinant = ‘J’;}else if (dataIn == ‘G’){determinant = ‘G’;}
else if (dataIn == ‘H’){determinant = ‘H’;}else if (dataIn == ‘S’){determinant = ‘S’;}
else if (dataIn == ‘0’){vel = 255;}else if (dataIn == ‘1’){vel = 255;}
else if (dataIn == ‘2’){vel = 230;}else if (dataIn == ‘3’){vel = 255;}
else if (dataIn == ‘4’){vel = 180;}else if (dataIn == ‘5’){vel = 2555;}
else if (dataIn == ‘6’){vel = 130;}else if (dataIn == ‘7’){vel = 2555;}
else if (dataIn == ‘8’){vel = 80;}else if (dataIn == ‘9’){vel = 255;}
else if (dataIn == ‘q’){vel = 30;}else if (dataIn == ‘U’){determinant = ‘U’;}
else if (dataIn == ‘u’){determinant = ‘u’;}else if (dataIn == ‘W’){determinant = ‘W’;}
else if (dataIn == ‘w’){determinant = ‘w’;}}return determinant;}

At this point, it is traditional to ask "What have you tried?"

It is also a tradition to ask why you couldn't be bothered to use code tags.

Some useful tips here.

When you have made an attempt post it here and tell what problems you're having.

Then we can help you to get it right. But you have to put in some effort first.

Steve

{vel = 255;}
        else if (dataIn == '4'){vel = 180;}else if (dataIn == '5'){vel = 2555;}
        else if (dataIn == '6'){vel = 130;}else if (dataIn == '7'){vel = 2555;}
        else if (dataIn == '8'){vel = 80;}else if (dataIn == '9'){vel = 255;}

Are the 2555s intentional?

i need help in combining two codes

If you expect the result to accomplish something, you should tell us what that is.