Servo doesn't work

The link to the servo I am using:

Code:

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards



void setup() {
  myservo.attach(3);  // attaches the servo on pin 9 to the servo object
  myservo.write(0);
  delay(2000);
}

void loop() {
  
    myservo.write(90);              // tell servo to go to position in variable 'pos'
    delay(1000);                       // waits 15ms for the servo to reach the position

    myservo.write(0);              // tell servo to go to position in variable 'pos'
    delay(1000);                       // waits 15ms for the servo to reach the position
  
}

The schematic is the basic one that is used to run the example in the servo library. When that didn't work, I switched the power line from the 5V to the Vin pin after connecting an external power supply to the Arduino power port.

Schematic
Image as in https://www.arduino.cc/en/Tutorial/Sweep

sorry, I tried attaching the image but it didn't work for some reason.