Servo in combination with two dc motors give problems.

I'm using two dc motors and a servo. The moment i add the line "myservo.attach(servoPin); // attaches the servo on pin 2 to the servo object" to the sketch only one motor turns. Can somone tell me what I'm doing wrong. The whole sketch is in the attachment.

motor_demo_h-bridge_L298N_ver_5.ino (1.43 KB)

Did you read this?

Perhaps you should.

I'm not using servo library . I'm using vasrservo library. Changed the pin number to 9. It didn't help.

SieKieR:
I'm not using servo library . I'm using vasrservo library. Changed the pin number to 9. It didn't help.

You've got the source of the VarSpeedServo library.
I don't.

Pin 9, huh?

The grounds are connected.

Can someone give me a solution?

I'd check the source of the library, to see if it uses the same timer as the standard servo library

Hi,
Can you post a link to the servo library you are using and can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

What are you using as a power supply for the motors and servo?

Thanks.. Tom.. :slight_smile: