Issue about driving a servo and DC motor at the same time in Arduino promini.

Hello, everyone.
The problem I have is as follows.

IDE: 1.8.2 V in windows
Arduino type: promini Atmega328 3.3V 8MHz
Element: 1 motor driver, 2 DC motors, 1 servo motor, 2 lithium polymer batteries.
Condition: servo lib. for servo motor, analogWrite func. for DC motor

Piece-wise code:

//analogWrite pin:3, 5, 6, 9, 10, 11

int servo_pin = 5;
int right_motor_pin = 10;
int left_motor_pin = 11;

void setup(){

//myservo.attach(servo_pin);
//pinMode(right_motor_pin, OUTPUT);
//pinMode(left_motor_pin, OUTPUT);

}

void loop(){

//myservo.write(value1);
//right_motor_go(value2);
//left_motor_go(value3);

}

Issue:

  • Servo works well in alone code.
  • Right DC motor works well in alone code.
  • Left DC motor works well in alone code.

If driving three parts simultaneously, left motor doesn't work.
So, I change the pins to other PWM pins, one motor always doesn't work.

Opinion:
Each part works well in alone code, so hardware and software is OK, I think.
Is it impossible to use 1 servo and 2 dc motors in Arduino promini?
Or am i something missing?
Plz help me.....

Thank you for reading my topic.

P.S.

If I add a myservo.attach(servo_pin) func in void setup,
then, left motor doesn't works.
But without myservo.attach(servo_pin) func in void setup,
then, left motor works.

In the opposite case,
with or without myservo.attach(servo_pin) func in void setup,
right motor always works.

Does PWM pins have an internal connection?

Question:

How are the motors being powered?

Are you trying to drive the motors directly from the Pro Mini?

How much current do the DC motors require? The Pro Mini outputs are limited in current capability.

I am using a pololu DRV8835 motor driver and connect all parts like attachments.
I don’t know exactly how much current the motor needs.

On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10,

From the Servo library reference.

All of your code is commented out. How is that supposed to work?

Read the how to use the forum sticky to see how to post code.

Please post your code (the full code - if too big create a minimal example demonstrating the problem), and circuit diagram of YOUR actual setup, the complete setup (hand sketched is fine) Don't leave anything out as more often than not the problem is in the part you left out.
Also links to the data sheet of the various motors and servos and other peripherals you may have connected.