Readable WiFi MAC address


  • Pybytes Beta

    In LoPy and WiPy 2.0, the WiFi MAC address can be shown via :

    import machine
    machine.unique_id()
    

    or

    import network
    network.WLAN().mac()
    

    But the result is in 6-byte format, not the usual MAC address with 6 hexadecimal bytes separated by ':'. To convert, use :

    import ubinascii
    ubinascii.hexlify(machine.unique_id(),':').decode()
    

    or :

    import ubinascii
    ubinascii.hexlify(network.WLAN().mac(),':').decode()
    

Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.