Uploaded sketch not working after power off

This my setup function and where should I put the delay?
I tried to put delay at 1,2 and 3 but still need to press the reset button.
And also tried with delay(2000);

void setup() {
  
// (1)
      pinMode(buttonPin, INPUT);
      pinMode(ledPin, OUTPUT);
  
      WiFly.begin();
 // (2)
      if (!WiFly.join(ssid, passphrase)) {
       
        while (1) {
          // Hang on failure.
        }
      }  
// (3)
}