Hi,
I am new to Servo control, and having some issues to let the Servo make a sweep form 0 to 180 and back.
Should be easy, but can not get it to work.
When I connect the power to the servo it will center, but when I connect the yellow control wire, the servo will rotate all the way to one side, every time, all the way to the end, and will not move any more. Every change in the program wont make any difference.
I hope someone can help me out.
Thanks in advance Arjen from the Netherlands.
Setup:
Pololu A-star 328 PB 5V 16Mhz
separate power source 7,4 Volt
Tower Pro MG90S Micro servo
Separate Power Source 4,6 Volt.
(works fine on servo tester)
Program:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
myservo.write(10); // sets the servo position according to the scaled value
delay(1000); // waits for the servo to get there
myservo.write(170); // sets the servo position according to the scaled value
delay(1000); // waits for the servo to get there
}