So, I've took my Arduino Duemilanove from the shelf again, and tought I was gonna try a little half-finnished robot that was laying around.
Lets cut to the problem, I've hooked up two servos, small 9g ones. And trying to control both servos at the same time. One servo is attached to pin 2 and the other one on pin 11.
It seems to be some kind of interference runing them both, cause if I take out pin 2 or 11, the other servo runs fine. If I insert it again they both start behaving choppy and strange.
Heres my code:
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
#include <Servo.h>
Servo servo_turn;
Servo servo_move;
void setup()
{
servo_turn.attach(2);
servo_move.attach(11);
}
void loop()
{
Center();
Forward();
delay(1000);
Left();
delay(2000);
Center();
delay(500);
Right();
delay(1500);
}
void Forward()
{
servo_move.write(10);
}
void Right()
{
servo_turn.write(76);
}
void Center()
{
servo_turn.write(87);
}
void Left()
{
servo_turn.write(100);
}
So, why won't they run smoothly when they both are plugged in?