Pages: [1]   Go Down
Author Topic: Servo Control  (Read 322 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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(smiley-cool;
}
 
///////////////////////////////////
void loop()
{
  scanServo.write(45);
  delay(3000);
  scanServo.write(90);
  delay(3000);
}
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16540
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Thanks again - James
Logged

Pages: [1]   Go Up
Jump to: