2
votes

Here is my very simple and complete sketch.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>

void setup() {
    delay(1000);

    Serial.begin(115200);
    Serial.println();

    WiFi.begin("ssid", "password"); //Edited out
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }

    Serial.println("Connected! Ip: " + WiFi.localIP());
}

void loop() {
}

The serial output is as follows:

...

I would expect to see "Connected! Ip: 192.168.2.xxx" but for some reason the application isn't showing this.

I can ping the device if I scan which new devices entered the wifi net work, and the SSID and password data are correct (I've edited them out here).

Also, the only reason it should stop printing dots is because the state is now connected.

Edit: The output from Serial.setDebugOutput(true);

scandone
..ip:192.168.2.15,mask:255.255.255.0,gw:192.168.2.254
.

Here it shows that it does get connected.

1
Try to add Serial.setDebugOutput(true) after Serial.begin()baao
@baao I've edited my question with the output.Tvde1
I had similar problems with the 8266, I'd try to a) replace println() with print(), reflash the device, set another baud rate.baao

1 Answers

0
votes

It ends up getting fixed by adding .toString(), like this:

Serial.println("Connected! Ip: " + WiFi.localIP().toString());