Display local ip adress? (Nodemcu/Esp8266)


#1

hello.
all is in the title.
im getting confused and can’t find how to display local ip adress.
i’m using nodemcu.

in deed i cant use this : https://www.arduino.cc/en/Reference/WiFiLocalIP
because the way i connect to wifi is like this : thing.add_wifi(SSID, SSID_PASSWORD);
and i’m using #include ESP8266WiFi.h / ThingerESP8266.h

thanks.


#2

Hi,

did you tested with WiFi.localIP() from the Arduino library? You can even add a resource to see the local IP address over Thinger.io, like:

#define _DEBBUG_
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>

#define USERNAME "XXX"
#define DEVICE_ID "XXX"
#define DEVICE_CREDENTIAL "XXX"

#define SSID "XXX"
#define SSID_PASSWORD "XXX"

ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

void setup() {
  Serial.begin(115200);
  
  thing.add_wifi(SSID, SSID_PASSWORD);

  // returning local ip address
  thing["localIP"] >> outputValue(WiFi.localIP().toString());
}

void loop() {
  thing.handle();
}