ESP8266 not logging into WiFi

I have a ESP8266 Lolin clone.
and I’m following the instructions from an online course with their sketch on how to login to WiFi.
there are no connects to bug up the works and the code is straight forward.

#include <ESP8266WiFi.h>

const char ssid[] = "17243";
const char password[] = "235689147";

void setup()
  // put your setup code here, to run once:

  Serial.print("Connecting to " );
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)


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


I reset my router to factory settings and issued a new password just to make sure.
I took a photo of the back of it to look at the ssid “17243-5G”
I’ve tried variations of the ssid with and without the ‘-5G’ but its still refusing to login.
it just keeps printing periods.

can you suggest anything?

I reset my router to factory settings

Then you no longer have an internet connection... (won't stop you connecting to WiFi).

This works on my ESP8266s

#define STASSID "Your SSID"
#define STAPSK  "Your password"
const char * ssid = STASSID;
const char * pass = STAPSK;

uint8_t wait = 0;
  while (WiFi.status() != WL_CONNECTED) {
    if (wait) {
    else {
      wait = 40;
      WiFi.begin(ssid, pass);

Try connecting another device to your WiFi using the credentials you have and see if it connects OK. At the moment you don't know if the problem is your access point or not.

thanks for your suggestion, but I tried it and it doesn't work either.
not sure what to do now.

I have just tried your code on a D1 mini and it works fine.

Note that the router's admin login password may not work as the password for the wifi login. My Arris has what it calls the "Pre-Shared Key" that I use with the wifi board login.