DC motors and Servo are not using with Bluetooth at the same time.

I tried ServoTimer2 also. There is a parasitic fact. Why can’t i work those with together?

Here my code;

HardwareSerial &bluetooth = Serial;

#include <Servo.h> // servo library 
Servo myservo;

int input='0'; //input to be used
String input2; //variable for string input


void setup() {
  myservo.attach(3);

  
  pinMode(A0,OUTPUT);
  pinMode(A1,OUTPUT);
  pinMode(A2,OUTPUT);
  pinMode(A3,OUTPUT);
  Serial.begin(9600);
 }

void loop() {
  if(bluetooth.available()> 0 ) // receive number from bluetooth
  {
    int servopos = bluetooth.read(); // save the received number to servopos
    Serial.println(servopos); // serial print servopos current number received from bluetooth
    myservo.write(servopos); // roate the servo the angle received from the android app
  }
if(Serial.available()>0)
 {
  input = Serial.read();
 }
 
// forward
if(input == '1')
  {
  digitalWrite(A0,HIGH);
   digitalWrite(A1,LOW);
   digitalWrite(A2,LOW);
   digitalWrite(A3,HIGH);
   }

 //back  
 else if(input == '2')
  {
   digitalWrite(A0,LOW);
   digitalWrite(A1,HIGH);
   digitalWrite(A2,HIGH);
   digitalWrite(A3,LOW);
}

//right
else if(input == '3')
  {
   digitalWrite(A0,HIGH);
   digitalWrite(A1,LOW);
   digitalWrite(A2,HIGH);
   digitalWrite(A3,LOW);
   }

  //left 
 else if(input == '4')
  {
digitalWrite(A0,LOW);
   digitalWrite(A1,HIGH);
   digitalWrite(A2,LOW);
   digitalWrite(A3,HIGH);
   }

   //default state
    else if(input == '0')
  {
digitalWrite(A0,LOW);
   digitalWrite(A1,LOW);
   digitalWrite(A2,LOW);
   digitalWrite(A3,LOW);
}
  }

I also tried any PWM pins.

Each function is blocking, i.e. stops the other function. If you want to do "multi threaded programming" per se, you should use the built in timer interrupts which can get very messy, very quickly.

I understand now but i can't figure it out. I try find an other way.

How can I use that timer? There is no other way.

I do. Like this; (Not need timer interrupt)

int input;

#include <Servo.h> // servo library 
Servo myservo1, myservo2, myservo3;
void setup() {
  myservo1.attach(3);
  myservo2.attach(5);
  myservo3.attach(6);
  
  pinMode(A0,OUTPUT);
  pinMode(A1,OUTPUT);
  pinMode(A2,OUTPUT);
  pinMode(A3,OUTPUT);
  Serial.begin(9600);
 }

void loop() {
input = Serial.read();

    if(input>=0 && input<180)  {
      myservo1.write(input);
    }
      
else if (input == 205)    //Gripper Move To Angle 0
{
  myservo2.write(0);
}
else if (input == 206)    //Gripper movw to angle 90
{
  myservo2.write(90);  
}
else if (input == 207)    //gripper move to angle 180
{
  myservo2.write(180);
}

else if (input == 202)    //Gripper Move To Angle 0
{
  myservo3.write(0);
}
else if (input == 203)    //Gripper movw to angle 90
{
  myservo3.write(90);  
}
else if (input == 204)    //gripper move to angle 180
{
  myservo3.write(180);
}
  
 else if(input == 241)
  {
  digitalWrite(A0,HIGH);
   digitalWrite(A1,LOW);
   digitalWrite(A2,LOW);
   digitalWrite(A3,HIGH);
   }

 //back  
 else if(input == 242)
  {
   digitalWrite(A0,LOW);
   digitalWrite(A1,HIGH);
   digitalWrite(A2,HIGH);
   digitalWrite(A3,LOW);
}

//right
else if(input == 243)
  {
   digitalWrite(A0,HIGH);
   digitalWrite(A1,LOW);
   digitalWrite(A2,HIGH);
   digitalWrite(A3,LOW);
   }

  //left 
 else if(input == 244)
  {
digitalWrite(A0,LOW);
   digitalWrite(A1,HIGH);
   digitalWrite(A2,LOW);
   digitalWrite(A3,HIGH);
   }

   //default state
    else if(input == 200)
  {
digitalWrite(A0,LOW);
   digitalWrite(A1,LOW);
   digitalWrite(A2,LOW);
   digitalWrite(A3,LOW);
}

  }