Servo not receiving PWM signal - help needed

Hi readers

I have problem with my 9g (SG90) servo, when i properly connect all pins, servo doesn’t respond.
I have tried with external power but unsuccessfully. After connecting and disconnecting 5v and ground makes servo move and i remember that servo worked some time ago but now it doesn’t…

I’m using Arduino Nano and sweep library from IDE
I think it’s problem with PWM connection from servo side

Connections:
Gnd - Brown
5v (internal or external) - Red
D5 (Pin 9) - Orange

Code:

#include <Servo.h>

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

int pos = 0; // variable to store the servo position

void setup() {
myservo.attach(9);
}

void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}

What did you use for external power?

When you used external power, did you connect the ground of that power supply to the ground of the arduino? This is needed.