Skip to content

NodeMcu never passing WiFi.status #4284

@Ethan17155

Description

@Ethan17155

Basic Info

Hardware

Hardware: NodeMcu esp8266 Amica
Core Version: ?

Description

I just got my first esp8266 board and tried to upload the WebServer library. And I upload the sketch and on the serial monitor it tells me it never connects. I have tried every single upload speed thinking I may be going to fast for the board but none of them work.

Settings in IDE

Module: esp 8266 built in
Flash Size: ?
CPU Frequency: 80Mhz
Flash Mode: ?
Flash Frequency: ?
Upload Using: SERIAL
Reset Method: nodemcu

Sketch

#include <ESP8266WiFi.h>

const char ssid[] = "************";
const char password[] = "*************";

WiFiServer server(80);

void setup() {
  Serial.begin(74880);
  while(!(Serial.available()));
  delay(10);

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println("ssid");
  delay(10);
  
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid,  password);

  //This is where it get stuck and just prints never ending dots <----------------------------------------
  while (WiFi.status() != WL_CONNECTED) {  //<-------------------
    delay(500);                                                 //<-------------------
    Serial.print(".");                                           //<-------------------
  }
  Serial.println("");
  Serial.println("WiFi connected");
  
  server.begin();
  Serial.println("Server started");

  Serial.println(WiFi.localIP());
}

void loop() {
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
  
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }
  String req = client.readStringUntil('\r');
  Serial.println(req);
  client.flush();
  
  if (req.indexOf("/hi") != -1)
  {client.print("hi");}
}

Serial COM13



Connecting to *************
........................................................................And so on

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions