I’m trying to use the wifi_ping example from the Arduino Seed rpcWiFi library, but I don’t get any ping response. I get these messages in serial monitor
“WiFi connected
IP address: 192.168.0.149
Pinging host www.baidu.com
5 packets transmitted, 0 packets received, 100.0% packet loss
Error :(”.
Pinging to the site via PC is ok and the PC is in the same network
“Ping www.wshifen.com [103.235.47.188] with 32 bytes of data:
Reply from 103.235.47.188: bytes=32 time=272ms TTL=46
Reply from 103.235.47.188: bytes=32 time=272ms TTL=46
Reply from 103.235.47.188: bytes=32 time=272ms TTL=46”
Can anyone help me?
Thanks
Hi there,
So you don’t really give enough info here to get good quality help , Only guesses.
What is the hardware, Which Xiao?
What is the Dev environment, Windows or ? Ide ? Arduino or PLio?
Post up the code you are using and we can look.
HTH
GL PJ
Meanwhile,
I got this working on a Xiao ESP32C6…
Here is the serial output.
Connecting to WiFi...
.
WiFi connected
IP address:
192.168.1.174
Pinging host: www.baidu.com
Ping success!
Ping time (ms): 326.02
Pinging host: www.baidu.com
Ping success!
Ping time (ms): 328.15
Pinging host: www.baidu.com
Ping success!
Ping time (ms): 328.28
I used BSP 3.0.5 and it chose the built in, and ESP PING LIB.
.
FQBN: esp32:esp32:XIAO_ESP32C6
Using board ‘XIAO_ESP32C6’ from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.5
Using core ‘esp32’ from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.5
–E4Brev—
Using library WiFi at version 3.0.5 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.5\libraries\WiFi
Using library Networking at version 3.0.5 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.5\libraries\Network
Using library ESP32Ping at version 1.7 in folder: D:\Arduino_projects\libraries\ESP32Ping
#include <WiFi.h> // WiFi library for ESP32
#include <ESP32Ping.h> // Ping library for ESP32
const char *ntpServer = "time.cloudflare.com";
const char *ssid = "SEEEDSurf-2.4";
const char *password = "SEEED_STUDIO";
const char *host = "www.baidu.com";
void setup()
{
Serial.begin(115200);
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.println("Connecting to WiFi...");
WiFi.begin(ssid, password);
// Attempt to connect to WiFi
while (WiFi.status() != WL_CONNECTED)
{
delay(1000);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop()
{
delay(5000);
Serial.print("Pinging host: ");
Serial.println(host);
// Send a ping to the host
if (Ping.ping(host)) {
Serial.println("Ping success!");
Serial.print("Ping time (ms): ");
Serial.println(Ping.averageTime());
} else {
Serial.println("Ping failed.");
}
}
Hi @PJ_Glasso, you are right about the details but I thought that inserting the topic in the WIO Terminal topic was automatic to indicate that I am working with WIO terminal. I used the wifiping example of the Arduino Seed rpcWiFi library. I insert the example below for clarity.
Click to see the code
/*
* This sketch sends data via HTTP GET requests to examle.com service.
*/
#include <rpcWiFi.h>
#include <rpcPing.h>
#include "secrets.h"
char ssid[] = SECRET_SSID;
char password[] = SECRET_PASS;
const char *host = "www.baidu.com";
const char *url = "/index.html";
void setup()
{
Serial.begin(115200);
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
delay(1000);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
int value = 0;
void loop()
{
delay(5000);
Serial.print("Pinging host ");
Serial.println(host);
bool ret = Ping.ping(host);
//float avg_time_ms = Ping.averageTime();
if(ret) {
Serial.println("Success!!");
Serial.println("TIME: ");
// Serial.println(avg_time_ms);
} else {
Serial.println("Error :(");
}
}
Thanks for any help