Help with analogWrite

I'm using an arduino uno to control an esc for a drone. In my first program it worked fine, but once I started a new program the analogWrite() function stopped working, the esc didn't respond at all.
This very simple program doesn't activate the esc at all:

void setup() {
  
  pinMode(3, OUTPUT);

}

void loop() {
  
  analogWrite(3, 255);

}

There's no error message but the esc clearly isn't receiving this data, even though analogWrite worked in a longer program I created earlier.

This is my first project so it's probably something really simple that I'm missing.

Usually you control an ESC with a signal like a servo gets and not a PWM signal like analogWrite puts out. Are you sure that your ESC is supposed to work this way?

Does the ESC need to be armed first?

The ESC definitely worked with analogWrite before...
I'll post the whole program that works here:

volatile int prev_time3;
volatile int pwm3;
ISR (PCINT2_vect)
 {
 // handle pin change interrupt for D0 to D7 here
  if (PIND & bit (2)) // if it was high
   prev_time3 = micros();
 else 
   pwm3 = micros() + 200 - prev_time3;
   analogWrite(11, pwm3/7.843);
   analogWrite(10, pwm3/7.843);
   analogWrite(9, pwm3/7.843);
   analogWrite(3, pwm3/7.843);
 }  // end of PCINT2_vect

void setup ()
  { 
  // pin change interrupt (example for D4)
  PCMSK2 |= bit (PCINT18);  // want pin 2
  //PCMSK2 |= bit (PCINT20);  // want pin 4
  PCIFR  |= bit (PCIF2);    // clear any outstanding interrupts
  PCICR  |= bit (PCIE2);    // enable pin change interrupts for D0 to D7
  pinMode (2, INPUT_PULLUP);
  pinMode (4, INPUT_PULLUP);
  }  // end of setup

void loop () {
  Serial.println(pwm3);
  }

In this program the analogWrite worked.
Thanks

So I guess the obvious question is then, what kind of ESC do you have.

This is my first drone so I don't know too much about ESC's but its name on amazon was
"UNIKEL 4pcs 20AMP 20A SimonK Firmware Brushless ESC with 3A 5V BEC for RC Multirotors Quadcopter" and it's just a 20A ESC. The connector it has does look exactly like a servo connector.

Teddy02:
The connector it has does look exactly like a servo connector.

There's a reason for that.

True... but it still worked before so I'm not really sure why it doesn't now :confused:

Thanks for the comment about it needing a signal like a servo, by using the servo library I have now got it to work with the writeMicroseconds function!