How to send IP address to phone

Hi everyone.
The sketch catch ESP32's local_IP address and print it.
How to forward this local_IP address to MIT APP interface on my phone, please.
Thanks
Adam


#include <WiFi.h>
#include <FS.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>

const char* ssid = "yourNetworkName";
const char* password =  "yourNetworkPassword";

AsyncWebServer server(80);

String text = "";

void setup() {
  Serial.begin(115200);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi..");
  }

  Serial.print("Server IP: ");
  Serial.println(WiFi.localIP());
  Serial.println("\n\n");

  server.on("/printIp", HTTP_GET, [](AsyncWebServerRequest * request) {

    request->send(200, "text/plain", "ok");

    Serial.print("Received request from client with IP: ");
    Serial.println(request->client()->remoteIP());
  });

  server.begin();

  Serial.print(WiFi.localIP());  //// added
  text = "";                     ////  added
}

void loop() {}

mia

The best place to start would be to work through the MIT App Inventor tutorials, and learn to send data to your phone.

1 Like

google is always worth a five minute search

https://www.google.de/search?as_q=arduino+sending+data+to+MIT+App+Inventor

https://www.google.de/search?q=MIT+App+Inventor+user+forum

1 Like

Great!
Thank you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.