360 SERVO POSITION

Hi, I'm new here and I need your help.

I'm new in Arduino stuff and I want to make a project with a servo motor and a color sensor. I have an GWS S125 1T\2BB servo and I want you to help me to can stop him in 4 different positions. Like 0 90 180 and 270.

What have you tried?

It's a sail winch servo, right?

#include <Servo.h>

Servo myservo;

int pos1 = 25;
int pos2 = 45;
int pos3 = 68;
int pos4 = 92;

void setup(){
  Serial.begin(9600);
  myservo.attach(9);
}

void loop(){
if(Serial.available() > 0)
  {
    char letter = Serial.read();
    if (letter == '1')
    {
      myservo.write(pos1);
      delay(100);
    }
    else if (letter == '2')
    {
      myservo.write(pos2);
      delay(100);
    }
    else if (letter == '3')
    {
      myservo.write(pos3);
      delay(100);
    }
    else if (letter == '4')
    {
      myservo.write(pos4);
      delay(100);
    }
  }
  
}

I've had written this a few minutes ago. Press 4 goes to 0, press 3 goes to 270, press 2 goes to 180 and 1 to 90 but I have another option? Can It be written different?

Sorry for my english ! :blush:

According to this, it goes from 0-360 with pulses between 1-2 ms, ie 1000-2000 us

So presumably myServo.writeMicroseconds() as follows would work:

1000us = 0 degrees

1250us = 90 degrees

1500us = 180 degrees

1750us = 270 degrees

2000us = 360 degrees?

Yeah. It works with myServo.writeMicroseconds(). Thanks for the moment. I'll come back if I have more Q.
Thanks.