User Tools

Site Tools


find_pico_mac_address

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
find_pico_mac_address [2026/08/17 18:48] – [Introduction] walkeradminfind_pico_mac_address [2026/08/17 18:56] (current) – [Getting the Pico MAC Address] walkeradmin
Line 14: Line 14:
   * <color #ed1c24>88:a2:9e:</color><color #00a2e8>01:49:57</color>   * <color #ed1c24>88:a2:9e:</color><color #00a2e8>01:49:57</color>
  
 +The first three numbers are to identify the manufacturer, the last 3 numbers are for the ID of the device. In a layer 3 network (most networks now) we generally use the IP Address of the device, but in purely Layer 2 networks then the MAC addresses are used.
 +\\ 
 +\\ 
 +----
 +==== Getting the Pico MAC Address ====
 +\\ 
 +As with most things Pico/Network we need a Python script. See an example below:
 +
 +<code:python | download>
 +import network
 +import ubinascii
 +
 +wlan = network.WLAN(network.STA_IF)
 +wlan.active(True)
 +
 +print(ubinascii.hexlify(wlan.config('mac'), ':').decode())
 +</code>
 +
 +Save the above code to your Pico as <color #22b14c>find-mac-address.py</color>
 +\\ 
 +\\ 
 +When you run the code in Thonny, you will see something similar to below.
 +\\ 
 +\\ 
 +{{ :pico-find-mac-address.png?800 |}}
 +\\ 
 +As can be seen, the code outputs the Pico MAC Address in to the shell window in Thonny.
 +\\ 
 +\\ 
 +----
find_pico_mac_address.1786992503.txt.gz · Last modified: by walkeradmin