Go Down

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

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

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

Thanks again - James

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy