Controlling servo and dc motor via Arduino Mega

I am using the Pololu simple motor driver, and maestro servo controller and pololu motor. My goal is to drive 2 dc motors (forwards and backwards) while at the same time control 4 servos with the Arduino Mega. IE when the dc motor is running, I can have the servos move up and down and the dc motors running without the dc motor stopping until I tell them to stop. My problem with a simple sample program, is that when the servo is moving, the dc motor seems to stop.

When I build a robot car and I am driving it, I want to have the servos swing back and forth when I press a button without without the motors stopping. Can you help me?
Here is my simple program with one servo and one dc motor. The dc motor seems to stop when the servo goes back and forth.
Thank you.

/ controlling a dc motor and servo via arduino mega.  Goal:  control the servo
//  and dc motor independently.  The motor seems to stop when the servo is moving?

void setup()

void loop()
  Serial1.write(0xAA);  //start the dc motor forward on serial 1 tx
  Serial2.write(0xAA); //move the servo arm up 
  delay(500);              //the delay is to give the servo time to get there
  Serial2.write(0xAA);  // move the servo arm back 
  delay(500);             //the delay is to give the servo time to get there

Hello, Scott.

Thank you for posting your code. When you say that you are using our simple motor driver, are you referring to one of our Simple Motor Controllers? If so, which one are you using?

Also, what power supply (or supplies) are you using? Could you post a picture of your setup and a diagram of your connections?


Hi Brandon,
I am using the mini maestro 12 servo controller, the 18v15 simple motor controller, a 12 volt pololu dc motor running at 6 volts, and arduino mega 2560, a 6 volt dc power supply for the motor controller and servo controller. and the arduino is powered off my lap top. I am sorry but I don’t have a diagram of my setup nor a picture (it looks messy for sure). I am sure everything is set up correctly, the servo works, the motor controller works driving the motor.

My question is why does the motor appear to pause when the servo is moving? Shouldn’t the motor keep running until i write code to stop no matter what I tell the servo? Even with delays() the motor should still run? Could you check my code.
Thank you

The default device number for our Simple Motor Controllers is 13 (or 0x0D in hex); it looks like you are using a device number of 1. Since you say the motor is moving, I am assuming you changed your Simple Motor Controller’s device number to 1. Other than that your commands look fine.

When you send the motor forward command to the Simple Motor Controller, it should continuously drive the motor forward until you send a command to stop it. I suspect that moving the servo while the motor is spinning might be pulling too much current from your power supply, and it is causing the motor to stop. What is the current rating of the 6V power supply you are using to power the motors and servo? If you have a multimeter, could you use it to read your supply voltage while your program is running to see if the voltage drops when the servo is moving?