B4R Library ESP32extras Library

Starchild

Active Member
Licensed User
This is a cut-down derivative of my rESP8266extras library. I removed any functions that were not supported by the ESP32 environment.

You can use the Demo Program provided at the top posting of the rESP8266extras library to play around with this library (will need to make minor changes to use this library with the demo).

Thanks to the B4X member "janderkan" who reminded me recently, that I never did a release of this library. It was originally written back in July 2018. But I stopped working on it around that time. I accidently sent it to janderkan when we were working on another library back in October 2018.

As per janderkan's request I am posting it now on to the forum for general use.

This rESP32extras library supported functions are:

Restart
FlashChipSpeed
CpuCycleCount
FreeHeapSpace
CpuFreqMHz
GetMacAddress
ConfigNetwork
ConfigAP
GetAPIP
IP2str
str2IP
Host2IP
IsBadIP
GetInternetIP
ConnectWPS
ConnectWPS2
SSID
GetLocalIP
GetSubnetMask
GetGatewayIP

Hope it is useful to other.
 

Attachments

Last edited:

Alberto Iglesias

Well-Known Member
Licensed User
This is a cut-down derivative of my rESP8266extras library. I removed any functions that were not supported by the ESP32 environment.

You can use the Demo Program provided at the top posting of the rESP8266extras library to play around with this library (will need to make minor changes to use this library with the demo).

Thanks to the B4X member "janderkan" who reminded my recently, that I never did a release of this library. It was originally written back in July 2018. But I stopped working on it around that time. I accidently sent it to janderkan when we were working on another library back in October 2018.

As per janderkan's request I am posting it now on to the forum for general use.

This rESP32extras library supported functions are:

Restart
FlashChipSpeed
CpuCycleCount
FreeHeapSpace
CpuFreqMHz
GetMacAddress
ConfigNetwork
ConfigAP
GetAPIP
IP2str
str2IP
Host2IP
IsBadIP
GetInternetIP
ConnectWPS
ConnectWPS2
SSID
GetLocalIP
GetSubnetMask
GetGatewayIP

Hope it is useful to other.
Hello my friend,

when I try to get the external IP, with GetInternetIP . I got: (IP Unset) , for local IP is working fine

I write 2 functions for this look:"

B4X:
Sub LocalIP As String    'ignore
    Main.ESPExtras.GetLocalIP(InternalIP)
    Dim strInternalIP As String = Main.ESPExtras.IP2str(InternalIP)
    Return strInternalIP
End Sub

Sub InternetIP As String    'ignore
    Main.ESPExtras.GetInternetIP(ExternalIP)
    Dim strExternalIP As String = Main.ESPExtras.IP2str(ExternalIP)
    Return strExternalIP
End Sub
do you know the reason?

sometimes getting OK, but sometimes get (IP UNSET)
 

Starchild

Active Member
Licensed User
Hello my friend,

when I try to get the external IP, with GetInternetIP . I got: (IP Unset) , for local IP is working fine

I write 2 functions for this look:"

B4X:
Sub LocalIP As String    'ignore
    Main.ESPExtras.GetLocalIP(InternalIP)
    Dim strInternalIP As String = Main.ESPExtras.IP2str(InternalIP)
    Return strInternalIP
End Sub

Sub InternetIP As String    'ignore
    Main.ESPExtras.GetInternetIP(ExternalIP)
    Dim strExternalIP As String = Main.ESPExtras.IP2str(ExternalIP)
    Return strExternalIP
End Sub
do you know the reason?

sometimes getting OK, but sometimes get (IP UNSET)
Hi
I checked the web service GetInternetIP() uses
"api.ipify.org" and it seems to work Ok for Me.
You could try reading any help information provided by ipify.org themselves.

Also noted in your example the declaration of the return variable is supposed to be an 4 byte array
B4X:
Sub InternetIP As String    'ignore
    Dim IPresult(4) as byte
    Main.ESPExtras.GetInternetIP(IPresult)
    Dim strExternalIP As String = Main.ESPExtras.IP2str(IPresult)
    Return strExternalIP
End Sub
Hope this helps.
 

Starchild

Active Member
Licensed User
Hi
I checked the web service that GetInternetIP() uses
"api.ipify.org" and it seems to work Ok for Me.
You could try reading any help information provided by ipify.org themselves.

Also noted in your example that the GetInternetIP() IPresult is supposed to be an 4 byte array.

B4X:
Sub InternetIP As String    'ignore
    Dim IPresult(4) as byte
    Main.ESPExtras.GetInternetIP(IPresult)
    Dim strExternalIP As String = Main.ESPExtras.IP2str(IPresult)
    Return strExternalIP
End Sub
Hope this helps.
 
Top