HOW DO I PROGRAM TO STOP MY SERVO

basically, i'm new to this arduino program,

i've programmed the servo to non stop rotating, but i dont know how to stop the servo from rotating 360 degree.

please help.

const int sensor2 =2;
const int led1 =13;

int sensorswitch2 =0;

int motorleft = 7;
int speed1 = 5;

void setup()
{
  
  Serial.begin(19200);
  
  pinMode (sensor2,INPUT);
  pinMode(led1,OUTPUT);
  pinMode(motorleft, OUTPUT);
}

 void loop()
 
 {
 
  
   int sensorswitch2 = digitalRead(sensor2);
   
    if (sensorswitch2=HIGH)    
    {
      digitalWrite(motorleft,HIGH);  
      analogWrite (speed1,50); 
    }
 
  else
  {
    if (sensorswitch2=LOW)
    
    {
      digitalWrite(motorleft,HIGH);  
      analogWrite (speed :o 1,225);
    } 
  }
  
 }

Did you convert a standard servo into a "continuous rotation servo"?

    if (sensorswitch2=HIGH)
...
...
    if (sensorswitch2=LOW)

BZZZZZT!

      analogWrite (speed :o 1,225);

We kinda expect you to post code that has an outside chance of making sense.

Even with a modified servo, it is still best to use the Servo library. analogWrite() doesn't do what you think it does.

    if (sensorswitch2=HIGH)

This is a very common mistake that even experinced programmers sometimes accidentally do as a typo. You need

    if (sensorswitch2==HIGH)

the single '=' does an assignment. You code unconditionally assigns HIGH to sensorswitch2 and then executes the motor left branch if that assignment was nonzero - which it always will be.