Thanks for all the replies They helped alot.
Ive finally conquered my problem!
-
As R mentioned, the power was an issue but have an external power source for the motor which also runs 5 volts but does the job.
-
I was confused about the code, I thought i needed to tell the arduino i wanted to move 90 degrees, but i just needed to tell the arduino what variable positions i want the motor to go to and from. For example...
#include <Servo.h>
Servo myservo;
void setup()
{
myservo.attach(9);
myservo.write(90);
}
void loop() {}
Code tells the motor to move to the variable position of 90 on the motor.
#include <Servo.h>
Servo myservo;
void setup()
{
myservo.attach(9);
myservo.write(180);
}
void loop() {}
Code tells the motor to go back to its starting variable position.
This is all i really needed, i assume there are other methods to achieve this but this one works best for my project.
Thanks everyone! ![]()