Engineering Design Project: using 2 continuously rotating servos

Hello!

I am new to Arduino and servos but would love some assistance. I need to control two servos, to rotate slowly, starting at a standstill. They must be able to rotate counter-clockwise, clockwise, and stop after receiving an input from a controller and sensed by an IR sensor. I’ve been doing left arrow key for counter-clockwise, right for clockwise, and ok to stop.

Some issues I am having include:
-not being able to fully stop the servo with myservo.write(90);. I have had to use myservo.detach(); to actually stop it.
-not being able to control the speed.

(for fun, I have set up a LED to turn on for clockwise motion, a different one to turn on for counter-clockwise motion, and both of them to turn off if the other is on and if there is no motion)

my code currently is:

#include <IRremote.h>
#include <Servo.h> 

Servo myservo;
int remote = 11;
int servopin = 9;
int clockwise= 0;
int counterclockwise= 180;

IRrecv irrecv(remote);

decode_results results;

void setup()
{
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    String s = String(results.value, HEX); 
    if(s != "ffffffff"){
      Serial.println(s);
    }
    
    if(s == "ffc23d"){
      myservo.write(clockwise);  // set servo clockwise by pressing the right arrow key
      myservo.attach(servopin);
      digitalWrite(5, LOW);
      digitalWrite(6, HIGH);   
    }
    else if(s == "ff22dd"){
      myservo.write(counterclockwise);  // set servo counter clockwise by pressing the left arrow key
      myservo.attach(servopin); 
      digitalWrite(6, LOW);
      digitalWrite(5, HIGH); 
    }
    else if(s == "ff02fd"){
      myservo.detach();  // stop servo permanently
      digitalWrite(6, LOW);
      digitalWrite(5, LOW);
    }
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
    
  }
}

Could anyone help or offer better solutions? Anything would be greatly appreciated.

You will need to experiment to find the exact "stop" value for each servo. It will not be exactly 90 degrees. And if you use Servo.writeMicroseconds() you will get much finer control.

...R