Hi there everyone! Dave here… I’m a complete newby to Arduino (UNO) and am trying to control a continuous rotation servo motor ( FEETECH FS5103R) which seems pretty happy just doing it’s own random thing.
I’ve tried a lot of tutorials, watched lots of videos and tinkered with the sweep library example with no real idea what I’m doing.
Please be kind, I’m not stupid, just very new to this tech and I will get it… as long as I know why I’m doing it wrong. I would like to make it go 0 - 360 then stop and wait for the next time I trigger it (that’s a whole new can of worms for me).
If someone can go through step by step so I can check that I have all the planets aligned… that’d be tops.
Have you been through the Core-Electronics tutorial below? If you have and it’s still not working post up you code and some photos of the setup and somebody on the forum should be able to help.
Yeah, that was the first step. No matter what I do, the servo just does weird stuff. I know the little adjustment/calibration screw is in the the motor to set it to a zero point or something, but I’m not sure how to set that up first. I have a feeling that that is the root of my problem. I’ll go through the tutorial again and again and see how I go tonight. I’ll be back with screen shots and photos if I have a massive fail.
This is my set up. 5V power supply, positive going to the servo, negative going to the earth on Uno, earth then going to servo (via breadboard) and control cable in Digital Output 9. Pretty sure that’s what the doctor ordered.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}