Most probably a dumb question.
I want to print the local IP of my ESP8266
How do I get the LocalIP?
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "33e25...";
IPAddress ip;
WidgetTerminal terminal(2);
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
Blynk.begin(auth, "Me", "Pass");
while (!Blynk.connect()) {
// Wait until connected
ip = WiFi.localIP();
terminal.println();terminal.println();terminal.println();terminal.println();terminal.println();
terminal.println(F("Blynk v" BLYNK_VERSION ": Device started"));
terminal.println();terminal.println();terminal.println();terminal.println();terminal.println();
terminal.flush();
digitalWrite(13, HIGH);
delay(5000);
//digitalWrite(13, LOW);
}
}
// the loop function runs over and over again forever
void loop() {
Blynk.run();
terminal.println(millis());
// Ensure everything is sent
terminal.flush();
}
The code above has he following behaviour:
If the line ip = WiFi.localIP(); is “live”, it seems as if the rest
of the code in the setup section is not executed, but control goes
straight to loop()
When that line is commented, all seems to work as expected.
ip = Blynk.localIP gives an error ‘class BlynkWifi’ has no member named ‘localIP’