WiFi.Ping() returns -120 on Argon

Tags: #<Tag:0x00007fe223c68128>


My Argon can connect to the network and connect to the Particle cloud. I am trying to test my Argon’s ability to reach devices on the network, and can’t seem to understand what WiFi.Ping() is doing for me. Everything I try returns -120. Does that mean that it can’t reach the destination, or what?

The code and the results I get are shown below.

The Code

IPAddress remoteIP(10, 245, 77, 21);
int numberOfReceivedPackage = 0;

void setup() {

void loop() {

    while(!Serial.available()) SPARK_WLAN_Loop();
    Serial.println("Pinging started...");
    numberOfReceivedPackage = WiFi.ping(remoteIP, 25);
    Serial.print("Pinging ended ->");

The Results
Pinging started...
Pinging ended ->-120


Is your ping target actually responding to pings? If not WiFi.ping() will just timeout.
Have you tried pinging that IP from your computer?

BTW, SPARK_WLAN_Loop() has been superceded ages ago by Particle.process().


Thats a good point. I had the Argon pinging itself. I pinged it from my PC and saw that it didn’t respond to pings.

I changed it so the Argon would ping my PC, but got the same -120.
I have tried pinging google.com and particle.io using the IP address resolved by ping from my PC, and got the same -120 response.

I didn’t realize that. I got the ping code from the forum here, and did the ol’ cut and paste. I’ll read up on the particle.process()