B4R Question [SOLVED] "rESP8266WiFi v1.32" problem with Connect2

cliv

Member
Licensed User
Longtime User
I use this code with NodeMCU-ESP8266 Lolin with rESP8266WiFi v1.30 and work very well:

B4X:
Private Sub AppStart
    Serial1.Initialize(115200)
 
    ' Fixed IP
    Dim b() As Byte = Array As Byte(192, 168, 0, 6)
    RunNative("SetIP", b)
 
    If wifi.Connect2(SSID,PASS) Then
        Log ("CONNECTED")
        ' code
    Else
        Log ("DISCONNECTED")
        ' code
    End If

End Sub

#if C
    void SetIP(B4R::Object* o) {
        B4R::Array* b = (B4R::Array*)B4R::Object::toPointer(o);
        IPAddress ip(ByteFromArray(b, 0),ByteFromArray(b, 1) , ByteFromArray(b, 2), ByteFromArray(b, 3));
        IPAddress gateway(192, 168, 0, 1);
        IPAddress subnet(255, 255, 255, 0);
        WiFi.config(ip, gateway, subnet);
    }
#end if

... but with rESP8266WiFi v1.32 always show DISCONNECTED.
 
Last edited:
Top