How can I add two different programs of bldc motor and servo motor in one so that they work in parallel? This is for the servo motor:

#include &lt;Servo.h&gt; //Servo library

Servo servo_test;
//initialize a servo object for the connected servo
int angle = 0;

void setup() {
  servo_test.attach(9);
}

void loop() {
  for(angle = 0; angle &lt; 180; angle += 1) {
    servo_test.write(angle);
    delay(15);
  }
  delay(1000);
  for(angle = 180; angle&gt;=1; angle-=5) {
    servo_test.write(angle);
    delay(5);
  }
  delay(1000);
}


This is for the bldc motor with esc:

#include &lt;Servo.h&gt;

Servo esc_signal;

void setup() {
  esc_signal.attach(12);
  esc_signal.write(30);
  delay(3000);
}

void loop() {
  esc_signal.write(55);
  delay(15);
}
Depending on how the code is driven. The simplest would be to simply run loop1 and loop2 in the new loop.