🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5stack Tough Mac Address

    Scheduled Pinned Locked Moved UIFlow
    3 Posts 2 Posters 3.7k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      RASBR
      last edited by RASBR

      Hi,
      Is there anyway to get the WiFi Mac Address for an M5stack Tough via the M5BlockMaker. I need a unique ID for the device to write in a Database.
      I tried some code but always gets the devices hanging and not responding, the latest was:

      import ubinascii
      import network
      ubinascii.hexlify(network.WLAN(network.STA_IF)).decode()

      The above was obtained from: link text

      Thanks in advance

      1 Reply Last reply Reply Quote 0
      • felmueF Offline
        felmue
        last edited by

        Hello @RASBR

        try something like below. Works for me.

        import network
        import binascii
        
        label0 = M5Label('label0', x=13, y=16, color=0x000, font=FONT_MONT_22, parent=None)
        wlan = network.WLAN(network.STA_IF)
        mac_bytes = wlan.config('mac')
        mac_str = binascii.hexlify(mac_bytes).decode()
        label0.set_text(mac_str)
        

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 0
        • R Offline
          RASBR
          last edited by

          Hi @felmue .
          Thanks for the reply. I think I got the solution the same time you sent me yours. I did use the code in here as below:

          I did an 'Execute' Block:

           import ubinascii
           import network
           wlan_sta = network.WLAN(network.STA_IF)
           wlan_sta.active(True)
           wlan_mac = wlan_sta.config('mac')
           wlan_mac=ubinascii.hexlify(wlan_mac).decode().upper()
          

          0_1682625965698_76e881c1-37df-4e5b-94f1-c33c0da572aa-image.png

          then a Label Block:

          wlan_mac
          

          0_1682626008432_147bf674-2e3a-4ea5-84fc-41c072d1ce42-image.png

          Anyway, thanks for taking the time and effort to reply.
          Rami

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post