moving 360 servo counter clockwise

Hello everyone!

Im currently building a robot with a 360 or a continuous servo (what ever it's name)
and I was able to move it clock wise for 5 secnods and then stop it.
with this code:
#include <Servo.h>

Servo myservo;

void setup()
{

myservo.attach(12);
myservo.write(0);

}

void loop()
{
myservo.write(10);
delay(5000);
myservo.detach();

}

But I can't do the same counter clockwise. Only with a regular 180 degrees servo.
I have seen tons of videos and explanations but most of them included complicated codes that I don't really understand (I'm pretty new to this world).

if someone could help me turn the servo counter clockwise with a relatively simple code I will be grateful.

thanks!!

  1. attach the servo in setup, then never detach it again.
  2. myservo.write(10); gives the speed n direction. play with the value. Probably also read the documentation :slight_smile:

For a continuous servo something like write(90) should be stop and lower numbers (0-80 odd) turn one way, higher numbers (100 to 180) the other way. So if write(10) goes clockwise then write(170) should go counter clockwise.

BTW you don't need to keep doing a detach(). Indeed in most programs you never need to use it.

Steve

Instead of myservo.write(10);

i changed the 10 to 100 and it works!!

thanks guys!!!