Arduino UNO and MOSFET, turn on PC with delay problem-SOLVED

I’m totally new to arduino and electrincs.

I want to use arduino for following purpose:

In case there is power outage, after power is back on, Arduino (which get power from PC over USB port),waits 10 seconds and turn on PC. Then, do nothing until next power outage occurs.

I’m using MOSFET as “Power button”, Pin 10 on arduino output is connected to MOSFET “Drain” (middle pin), gate MOSFET pin connected to “Plus” pin on the motherboard, “source” pin to “Minus” pin on the motherboard.

Arduino code:

int led=10;
void setup() {
  // put your setup code here, to run once:
  delay(10000);
  pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);
  
}

void loop() {
  // put your main code here, to run repeatedly:
 
    
}

As soon as i connect Arduino to PC USB port, PC is turned on.

When i turn Power supply off, and then turn it back on, Arduino do not turn PC on after 10 seconds, nothing happens.

What’s wrong with above setup ?

To get started, attache the wiring digram.

Try this

void setup() {
  // put your setup code here, to run once:
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);// Iniate output to be inactive.
  delay(10000);
//  pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);
  
}

Thanks for your answer, diagram just attached, after applying your code, as soon as i plug arduino into PC, computer power on, after 2 seconds it's turned off and remains in this state.

However, with this code, machine starts 10 seconds after plugging power cord, but 2 seconds after it, it's shut down:

void setup() {
  // put your setup code here, to run once:
  pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);
  delay(10000);
  digitalWrite(led, LOW);
  delay(500);
}

Finally got it working:

void setup() {
 // put your setup code here, to run once:
 pinMode(led, OUTPUT);
 digitalWrite(led, HIGH);
 delay(10000);
 digitalWrite(led, LOW);
 delay(500);
 digitalWrite(led, HIGH);
}

Greate! Thanks for telling!

So where does the 2 seconds come in...?

No idea, i only know that without 500ms seconds delay, PC turns OFF.