Jump to content
43oh

Issues with Servo library


Recommended Posts

G'day oh 43oh wise ones.

 

Could someone who owns an RC servo please verify this?

 

When I load the code from Examples/Servo/Sweep into my Launchpad v1.5 (with a 2553), the servo jitters with a very regular (~1 second) timing.

 

// Sweep
// This example code is in the public domain.
 
 
#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
 
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() 
    myservo.write(90);              //Set 90 degrees
}
 
 
/*
void loop()
{
 for(pos = 0; pos < 180; pos += 20)  // 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(2000);                       // waits 15ms for the servo to reach the position
 }
 for(pos = 180; pos>=1; pos-=20)     // goes from 180 degrees to 0 degrees
 {                                
   myservo.write(pos);              // tell servo to go to position in variable 'pos'
   delay(2000);                       // waits 15ms for the servo to reach the position
 }
}
 
*/
 
 

 

 

 

Notice I kept the example simple by just requesting one angle.  The commented out code is a slightly modified version of the Example Servo Sweep code that further demonstrates the issue.

 

Just for reference, Win 7, Energia 0010 or 0011. Turnigy 1258 servo.

Also downloaded Energia 0011 on another PC and compiled from there.

 

When the same Example code (ie Servo/Sweep) is loaded into an Arduino Mega, there is no jitter whatsoever.  The servo moves to the requested position and shuts up.

 
Any ideas (and thanks in advance!)?
 
Paul
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...