Coder Social home page Coder Social logo

Comments (5)

earlephilhower avatar earlephilhower commented on June 12, 2024 1

We implement pretty much the Arduino WiFi library, so for docs the official website is probably the best bet.

That said, ping seems to be working fine here with a very simple MCVE:

#include <WiFi.h>

#ifndef STASSID
#define STASSID "your-ssid"
#define STAPSK "your-password"
#endif

const char* ssid = STASSID;
const char* password = STAPSK;

WiFiMulti multi;

void setup() {
  Serial.begin(115200);
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  multi.addAP(ssid, password);
  if (multi.run() != WL_CONNECTED) {
    Serial.println("Unable to connect to network, rebooting in 10 seconds...");
    delay(10000);
    rp2040.reboot();
  }
  Serial.println();
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  Serial.printf("Ping 8.8.8.8 result: %d\n", WiFi.ping(IPAddress(8,8,8,8)));
  Serial.printf("Ping GW result: %d\n", WiFi.ping(WiFi.gatewayIP()));
  Serial.printf("Ping 10.0.0.1 result (should fail): %d\n", WiFi.ping(IPAddress(10,0,0,1)));
  delay(10000);
}

Gives

11:06:20.291 -> WiFi connected
11:06:20.291 -> IP address: 
11:06:20.291 -> 192.168.1.131
11:06:20.325 -> Ping 8.8.8.8 result: 128
11:06:20.325 -> Ping GW result: 128
11:06:35.320 -> Ping 10.0.0.1 result (should fail): -1

from arduino-pico.

earlephilhower avatar earlephilhower commented on June 12, 2024

WiFi::ping() already exists. What exactly are you asking about?

from arduino-pico.

5chufti avatar 5chufti commented on June 12, 2024

Hi,
sorry but I couldn't find any traces in the documentation (arduino-pico.readthedocs.io WiFi) or the examples - so I assumed it not to be implemented.
rgds

from arduino-pico.

5chufti avatar 5chufti commented on June 12, 2024

as in the docs esp8266 was referenced for WiFi, I primarily looked there and only found reference to ESPpin lib ...
thanks for your clarification !

from arduino-pico.

earlephilhower avatar earlephilhower commented on June 12, 2024

Yeah, that's kind of on me. The WiFi class itself (i.e. WiFi.begin, WiFi.end, etc.) is pretty much Arduino, but the support classes like WiFiClient, WebServer, etc. are much closer to the ESP8266/32 (if there even is an official Arduino equivalent).

from arduino-pico.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.