Servo Movement Issues

I have been working on a project that has three servos. A base and two arms. I am using 360 degree rotary servos. I need to get the servo to move from 30 degrees to 90 degrees back and forth slowly twice. I'm not sure how to limit it to stop after repeating that process twice. My main issue is that when I use the following code:

// Sweep
// by BARRAGAN http://barraganstudio.com
// 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()
{
for(pos = 30; pos < 90; pos += 1) // goes from 30 degrees to 90 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 90; pos>=1; pos-=1) // goes from 90 degrees to 30 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}

This code makes the servo move way to quickly and it has no stopping point. Any advice would be appreciated. Thank you in advance.

I am using 360 degree rotary servos.

Ditch these - they're not servos any longer.

is there anyway to make it work? I already assembled it and have no more cash to buy new one.

You can add limit switches, either mechanical, optical or magnetic.

I find it hard to believe that there is no way to just program it to do what I stated in the first post.

If your "servos" are modified standard R/C servos, then I find it extremely simple to believe that you can't do what you stated you wanted to do.
They are no longer servos, in that they no longer have the ability to be commanded to a particular position and to hold that position.
In my opinion, they should not be described as, or sold as servos.

Of course, this is all just supposition on my part, because you haven't actually described the devices, or provided links.

I purchased a parallax continuous rotation servo, and two 360 degree analog servos. It has not been modified in any way shape or form. Will I be able to do what I stated in the first post with this servo?

Not without additional hardware.

They are not servos, and should not be described as servos.
Ask for your money back.

Thank you for your help, I will be very careful the next time I attempt to buy a servo. I am slightly discouraged but Ill see what I can do. Thank you again for your assistance.

I'm sorry to be the bearer of bad news.
There are servos capable of a couple of complete turns (they're usually sold as sail winches) but they're usually more expensive than regular servos.

I really do wish the stores would not describe these devices as servos.

It definitely comes across as false advertisement.

The reason those "servos" will not work is because they lack the key feature normal servos have, which is a potentiometer. The potentiometer is the only way for the servo to get feed back from its position. You take that out, and it becomes a continiously rotating motor.

Added: why not just use a rotorary encoder to keep track of the position?

ashtonmehrle:
I purchased a parallax continuous rotation servo, and two 360 degree analog servos.

There is IMO a small chance that the "360 degree analog servos" are actual servos. Probably they're just mis-described "continuous rotation servos" i.e. not actually servos, but you might get lucky.

It's easy enough to test - just connect the servo (with a suitable power source) and use the Servo library to send it to a position - if it moves to that position and stops, it's a real servo. If not, I'd argue that it was not as advertised and get a refund.

(I don't think you'd be entitled to a refund for something that was advertised as a "continuous rotation servo" since that's what it is.You might be protected by distance selling regulations if you bought them online.)

Ill give it a shot thanks a lot.

There is IMO a small chance that the "360 degree analog servos" are actual servos.

At $13 a pop, there are two chances that they're actual servos - slim and fat.

well servo or not I was able to find a round a bout way to program them using physical stops and some weird code. thanks for the advice though.

ashtonmehrle:
It definitely comes across as false advertisement.

I don't really see any thing false in their ad.

https://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/900-00008/List/0/SortField/4/ProductID/102/Default.aspx

I don't really see any thing false in their ad.

l do - the word "servo", without the qualifier "ex"

AWOL:

I don't really see any thing false in their ad.

l do - the word "servo", without the qualifier "ex"

From an engineering perspective, a servo might be some mechanism that is commanded to do something and it continues to do that something until a different command is received. Could be holding a specific position or maintaining a specific speed/direction of rotation. It would be good if the vendors would make a disclaimer that the continous rotation servo will not go to or hold a commanded static position.

  1. noting the action of certain mechanisms, as brakes, that are set in operation by other mechanisms but which themselves augment the force of that action by the way in which they operate.