Hi !
I'm new to the forum, I am having issues while trying to use a servo-motor with my Arduino Uno
The code I am using is :
#include <Servo.h>
Servo myservo;
int flag=0;
void setup() {
myservo.attach(2);
myservo.write(96);
delay(2000);
}
void loop()
{
if (flag==0)
{
myservo.write(141);
delay(2000);
myservo.write(51);
delay(2000);
// flag=1;
}
else
{
myservo.detach();
delay(2000);
}
}
The code works perfectly when using a USB cable.
The problem is that I want to use an external power supply (a 10V battery)
When I try to run the code with the battery, the motor does shit, going one way, then the other, not as I'm asking in the code.....
Has anyone ever had any similar problem?
Thanks in advance
Guillaume