for all who want to make a continuous rotating servo works like a non one

i saw that a lot of people wants to get their continuous servos works like normal servos but we always say taht it is impossible to do it with code
but to day i found a way to make it work like this with a very simple code
so you should know that the continuous servo work with those writes
90 to stop
0 to turn clockwise
180 to turn counterclockwise
so my code is

#include <Servo.h>
Servo moto;

void setup(){
  moto.attach(9);
  
}
void loop(){
  moto.write(90);
  [color=green]delay(200);[/color]
  moto.write(180);
  [color=red]delay(70);[/color]

}

the delay with green color you can change it as you like the while to stop the servo
but the red delay you can changed but notice that
delay with 70 makes 90 degrees
delay with 145 or 140 makes 180 degrees
and you can count the others
this code is for the void loop
if you want to make it turn just for once
see this code

#include <Servo.h>
Servo moto;

void setup(){
  moto.attach(9);
  moto.write(90);
  [color=green]delay(200);[/color]
  moto.write(180);
  [color=red]delay(70);[/color]
  moto.write(90);
  [color=green]delay(200);[/color]
}
void loop(){
}

the delay with green color you can change it as you want
the red delay is the same as before

i hope that you enjoy the lesson
and i hope that i helped you with this lesson
make sure that i create this code and you will not find it anywhere
please let all the rights for me
i am here for any questions
thank you all

You forgot to mention about different servos needing different timings, and the fact that the angles may vary from run to run.

With no feedback from the output of the servo all bets are off as to where it is. It is not good enough to rely on timing the rotation of the servo to determine what angle it is at because it will depend on the loading on the output as to how fast it moves, to say nothing of the input voltage which will vary and thus change the speed of the servo

Needs a little more work.

@Isra2006

Moved your topic to it's current location as it is more suitable.

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Isra2006, I don't believe that works. Don't trick others to test that. Do the tests yourself with different servos and different loads. And show us the results.

Considering how cheap servos are it hardly seems worth the trouble.

...R

thanks very much for your replies
i don't said that this is an approved way to do that
but i showed the way to do it
i just said that it is not impossible to do this thing
of course i tested everything and it works with me
if you don't beleive me try yourself
please next time try to understand my tries and then criticize me
of course i will work and i will do my best to improve that
any way thanks too much for bringing all this to my attention

Johan_Ha:
Isra2006, I don't believe that works. Don't trick others to test that. Do the tests yourself with different servos and different loads. And show us the results.

thanks for replying
if you want to criticize any one please try first
i am not here to spend my time and trick people
i am like every one here trying to help
i showed you the way and you can improve it as you want
i tested everything before posting
please respect my efforts next time
any way thanks sir

You are posting on a forum where facts need to be facts.
I applaud your efforts so far but they are incomplete is what we all seem to be saying.

That is why I moved it from tutorials as it was not quite ready for prime time.
Don't let that dissuade you but take it as "constructive criticism" to help you make it better.

Bob.

ballscrewbob:
You are posting on a forum where facts need to be facts.
I applaud your efforts so far but they are incomplete is what we all seem to be saying.

That is why I moved it from tutorials as it was not quite ready for prime time.
Don't let that dissuade you but take it as "constructive criticism" to help you make it better.

Bob.

thanks for your reply
of course i understand why did you move it and i respect that
there is someone said that i trick others i cant consider that like a constructive criticism
but for others replays i will work to improve that
i am not posting false things i am posting facts and you can check
thanks so much sir

I don't believe you tested your own code.
You had this:

  void loop(){
  moto.write(90);
  delay(200);
  moto.write(180);
  delay(70);

}

In the loop it first stops the servo, delays 200 ms, then makes it rotate with full speed in one direction for 70 ms. Then it starts all over, stopping the servo for 200 ms, then turning it again in the same direction for 70 ms. Then it starts all over again.

That's not the behaviour of a non continuous servo, is it? Sure you should have noticed that, when you tested it.

The thing is, we all noticed that this technique fails, when there's a varying load on the servo and when there's a varying power (voltage) for the servo (say you have a common power source for several things, some of which are on at the same time). The error simply builds up the longer you run the servo back and forth. Without feedback, relying only on timing, it won't work. This is what we know without testing. That's why we won't test it. Prove us wrong, honestly I'd like to be proven wrong here!

If you can't figure out how to test, here's a simple approach. Make your servo twist back and forth 90 degrees 10 times, then stop. Will it stop exactly where it started? Repeat the test and add some load by simply lightly preventing it from rotating when it rotates clockwise. Where will it stop? Repeat by preventing it when rotating counterclockwise. This is a test I perform in my imagination to your setup. And it fails.

Or just put a light load on the servo, rotate it 90 degrees to lift the load off the bench and see if it will stay in position. Real servos do that easily.

It's good that you're trying but I'm afraid you've just proved that all those people who say you can't get a continuous servo to behave like a normal servo are exactly right.

Steve