Please help. I reached a dead end

Hello my friends
I made a code that checks Google’s Bing and displayed it on a terminal. Please help me. I want to change the IP from the application. I tried four float variables for you. The process did not work. I am looking for a solution.


void loop()


I created a couple of projects recently where I used WiFi smart switches to ping various external websites (Google, Amazon, Microsoft etc) to check that they were still accessible. If they weren’t then it meant either my internet was down or that my router had locked-up and needed rebooting (the latter seems to happen from time to time), so the smart socket took care of that task automatically when all of the external websites had multiple failed ping attempts.

I tried lots of ping libraries and most were extremely poor. many had memory leaks that caused reboots after repeated pings and others had functionality issues.
Eventually, I ended-up using this library:

although it too has a bug that means the ping command always returns true, even if the ping fails. Details here:

There is a workaround to this though, because the OnRecieve response from the ping callback is accurate and that can be used instead.

I mention all of this as I spent many hours trying to get a reliable working system, and if you are experiencing any issues with your current system that you might want to switch libraries before you go much further.

On to your specific issue…

Your ping library (and the one I use) requires an IPAddress type variable. You’ve called it PING_TARGET

You’re collecting 4 float type variables for the 4 elements of the IP address…

Personally, I think I would have used Integers, but whatever you use needs to be converted into a string with commas between the 4 elements of the IP address.
However, converting a String type variable into an IPAddress type isn’t easy, but may be do-able using the c_str() command to teat the string as a char array and then convert to IPAddress (you’d need to experiment).


Thank you for the help dear Can you give me a code if you have what solves my problem?

I don’t have any readymade code for you, as I don’t go down the route of inputting the IP addresses that I ping via the app.