Go Down

Topic: Servo newbie needs help (Read 1 time) previous topic - next topic

mistergreen

hi,
I'm trying to make a servo rotate continuously so I used this code.
Code: [Select]

void loop()
{

 for(pos = 0; pos < 360; pos += 1)  
 {                                  
   myservo.write(pos);              
   delay(15);                      
 }

 
}


When it reaches 360, it changes direction back to zero. It's sweeping back and forth. How do I make it keep spinning continuously?

Thanks.

mistergreen

oh, ok
http://www.sparkfun.com/datasheets/Robotics/servo-360_e.pdf

model: SM-S4303R

zoomkat

Quote
When it reaches 360, it changes direction back to zero. It's sweeping back and forth. How do I make it keep spinning continuously?


You would have to modify your servo into a "continous rotation" servo. Once it is modified, it will lose it's capability to be positioned in a specific location. You might be better off getting another inexpensive servo and modifying it (like below), or buying a servo that is already modified for continous rotation.


http://www.lynxmotion.net/viewtopic.php?f=31&t=6388
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

mistergreen

I finally found some code help on through sparkfun
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1278145608

this servo does spin continuously but can't address what angle the shaft so my code was all wrong.

I should have just send in a wavelength

myservo.writeMicroseconds(i);

and it will spin at a certain speed & direction.


Go Up