Pages: [1]   Go Down
Author Topic: DC motor interrupts servo  (Read 448 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (0.68 KB - downloaded 7 times.)
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49343
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  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?
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Duane B
Logged


Pages: [1]   Go Up
Jump to: