NewGuy here--need guidance

I have the ESP32 with the OLED display, and the factory test connects fine, but I want to get the IP address and display it along with the SSID it’s connected to. Looking at the library, can’t figure out how to ask for the ip then fit it to a Heltec.display -> drawString cmd to display it. Been a LOT of years since I programmed from reading a library.

Thank you


here is an example:

display.drawString(40, 30, "READY");
display.drawString(40, 40, WiFi.localIP().toString().substring(0, 7));
display.drawString(40, 50, WiFi.localIP().toString().substring(8));

This shows the IP in 2 rows.
I used this in my Programms for the wireless stick.

Thank you, I found this today in my rambling…appears to be mostly like yours:

Heltec.display->drawString(0, 19, WiFi.localIP().toString().c_str());

This one prints the IP address on one line on the oled attached to the board.
It’s been a great many years since I programmed in C. When I learned, there wasn’t any C++ yet.
Does that make me old? Old enough to have trouble grasping some of the programming.

Thank you for your help.Care to explain the .substring? I would guess 0, 7 refers to is 8 just
referring to the start in the string to the end?

the Substring(0,7) means start at position 0 and take 7 caracters.
the Substring(8) means start at position 8 and take all to the end.

i had to split the ip cause the display on the wireless stick is really small.

Thank you. That is what I thought. Getting back into this stuff is harder when you are older. Takes longer to sink in.