ESP32 print ip on startup

How do I get ESP32 to serial print IP address on startup using Arduion IoT editor.

Can I add Serial.println(WiFi.localIP()); to the ArduinoCloud.update(); function?? Where can I edit the ArduinoCloud.update(); function.

If I put Serial.println(WiFi.localIP()) is the void loop() it prints continuously.

Thanks

Use a bool flag so that it only prints once.

1 Like

Tried the following code but the wifi connection doesn't work on the first pass so the flag gets bypassed.

Looks like I need to put the flag inside the ArduinoCloud.update(); function.

How can I do this?

void loop() 
{
  if (flag == 1) 
  {
    Serial.println(WiFi.localIP());
    flag = 0;
  }
  else 
  {
    //Flag not tripped, DO THIS
  }
  ArduinoCloud.update();
}

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