B4R Library ESP8266 Ping

rESP8266Ping is based on: https://github.com/dancol90/ESP8266Ping
It is an ESP8266 only library.

It implements a ping feature which can be useful to test whether a remote server is reachable.

Example:
B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Private wifi As ESP8266WiFi
   Private ping As ESP8266Ping
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   If wifi.Connect("dlink") Then
     Log("Connected to network")
   Else
     Log("Failed to connect to network")
     Return
   End If
   Log("google.com: ", ping.PingHost("google.com", 2))
   Log(ping.AverageTime)
   Log("nonexistdomain234.com: ", ping.PingHost("nonexistdomain234.com", 2))
   Log("local ip: ", ping.PingIP(Array As Byte(192, 168, 0, 6), 2))
   Log(ping.AverageTime)
End Sub
 

Attachments

  • rESP8266Ping.zip
    3.7 KB · Views: 989

kolbe

Active Member
Licensed User
Longtime User
Can't quite figure out why this library won't compile. I can use wifi just fine. The original ping library works in the Arduino IDE too. If I include the rESP8266Ping library in a B4R project I get the following error. It's not being pulled into the sketch directory and I don't understand the mechanism for this either.

B4X:
Compiling & deploying Ino project (ESP32 Dev Module - COM3)    Error
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
In file included from C:\Users\brdan\DOCUME~1\BASIC4~2\CLOCKT~1\Objects\bin\sketch\rESP8266Ping.h:3:0,
                 from C:\Users\brdan\DOCUME~1\BASIC4~2\CLOCKT~1\Objects\bin\sketch\B4RDefines.h:31,
                 from C:\Users\brdan\DOCUME~1\BASIC4~2\CLOCKT~1\Objects\src\src.ino:1:
C:\Users\brdan\DOCUME~1\BASIC4~2\CLOCKT~1\Objects\bin\sketch\ESP8266Ping.h:24:25: fatal error: ESP8266WiFi.h: No such file or directory
compilation terminated.
 

viriato

Member
Licensed User
Longtime User
You need to test it with an ESP8266 board. I'm not sure that it is compatible with ESP32.
Hi,
If somebody tested the ping librairy for ESP32 ?
or any other sugestion to ping device on ESP32 ?

Thanks a lot
 
Top