Go Down

Topic: Servo Control (Read 416 times) previous topic - next topic

Jamesmartin

I'm a complete nub with Arduinos so I know I'm missing something really basic but I'm at a loss as to what it is.

Could someone explain to me why the following sketch produces constant and jerky servo thrashing instead of 2 moves every 6 seconds?

I'm not using a full rotation servo.

Thanks - James

#include <Servo.h>

//servo object
Servo scanServo;

///////////////////////////////////
void setup()
{
  scanServo.attach(8);
}

///////////////////////////////////
void loop()
{
  scanServo.write(45);
  delay(3000);
  scanServo.write(90);
  delay(3000);
}

retrolefty

Possibly because you are powering the servo from the boards +5vdc and the servo is drawing more current then the board can handle? How are you powering the servo? How is the board getting power, USB or external power connector?

Lefty

Jamesmartin

Thanks!! That was it. Hooked it up via a power adapter and it's behaving predictably now.

Thanks again - James

Go Up