Readable WiFi MAC address



  • 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
 

Pycom on Twitter