0

So I was working on a far more grand project, until I discovered that I couldn't get any of my servos to move.

I've gone back to basics, and am trying to just get the boilerplate code found here, working.

#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
  }
}

Here are pictures of my setup.

  • You can embed pictures into your question (I'm not sure of the limit if you don't have much rep - at least one or two). For short code it helps to embed the code as well - I did that for you. You can provide a link so people know where it came from. – Nick Gammon Jun 1 '16 at 6:06
1

The only thing I see that could be the problem is with your servo wiring. It seems that most servos use this kind of wiring Servo Wires

Which is the way that you seem to wire it, but depending on how Radioshack servos are made the signal wire could correspond with a different wire. I imagine this could possibly be on the packaging so I would start by looking there to confirm your wiring.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.