ESP8266 Not Connecting

I have what has to be the most basic 8266 sketch possible. But, it doesn’t work - of a few dozen tries, it has only once managed to connect. These same 8266 modules connect reliably to the same network using the stock AT firmware.

Any clues what the problem could be? I have a hard time seeing how this possibly could NOT work…

#include <ESP8266WiFi.h>

// Replace these with your WiFi network settings
const char* ssid = "TP-LINK_A47DC2"; //replace this with your WiFi network name
const char* password = "79517515"; //replace this with your WiFi network password

void setup()
{
	delay(1000);
	Serial.begin(115200);
	delay(1000);

	WiFi.begin(ssid, password);

	Serial.println();
	Serial.printf("Connecting to %s %s\n", ssid, password);
	while (WiFi.status() != WL_CONNECTED)
	{
		delay(1000);
		Serial.print(".");
	}
	Serial.println("success!");
	Serial.print("IP Address is: ");
	Serial.println(WiFi.localIP());
}

void loop()
{
}

Regards,
Ray L.

Weird. No idea what changed, but I did one more compile (after more than a dozen), and it's now working perfectly....

Regards,
Ray L.