Other B4R v1.20 BETA - Support for ESP8266 Boards

Status
Not open for further replies.

janderkan

Active Member
Licensed User
Thank you for the WiFi.disConnect method.
Like to have the WiFi Mac address.


This works, using global variables.
I cannot figure out how to use global array in C part.

B4X:
sub Process_Globals   
    Dim MacArray(6) As Byte
    Dim M1,M2,M3,M4,M5,M6 As Byte            'ignore
End Sub

Sub MacAddress() As Byte()
    RunNative("getMac", Null)
    bc.ArrayCopy(Array As Byte(M1,M2,M3,M4,M5,M6),MacArray)
    Return MacArray
End Sub
#if C
    #include <ESP8266WiFi.h>
    uint8_t MAC_array[6];
    void getMac(B4R::Object* u) {
         WiFi.macAddress(MAC_array);
         b4r_main::_m1 = MAC_array[0];
         b4r_main::_m2 = MAC_array[1];
         b4r_main::_m3 = MAC_array[2];
         b4r_main::_m4 = MAC_array[3];
         b4r_main::_m5 = MAC_array[4];
         b4r_main::_m6 = MAC_array[5];
    }
#end if
 
Last edited:
Status
Not open for further replies.
Top