DC motor interrupts servo

Hi all

I'm really a newbie in the arduino world and i wanted to build a little car whose wheels will be controlled by a dc-motor and there angle will be controlled by a servo. So basicly there's a Dc motor on top of a servo.
I wrote some code which actually should turn the servo 90 decrees then activate the motor, turn the servo from 90 decrees back to 0 and turn the motor again on.The Problem is when the motor start, the servo turns to 0 and when it actually should turn from 90 to 0 it goes first from 0 to 90 then to 0.

sketch_sep27a.ino (699 Bytes)

  for(pos = 0; pos < 90; pos += 1)  
  {       
    myservo.write(pos);              
    delay(15);       
 } 					//servo turns to 0

If the goal is to get the servo to position 89, why not just tell it to get to 89? There is no purpose served by making it go there slowly, is there?

Most likely, you don't have a coding problem, you have a wiring problem. What is connected to what? What is powering the motor? The servo?

Hi,
The two links in my signature might help you with this

Duane B