nodemcu micropython网络相关资料
启动webrepl
按照提示设置好启动,wifi密码等信息.
nodemcu查看mac地址 webrepl
- import network
- import ubinascii
- mac = ubinascii.hexlify(network.WLAN().config('mac'),':').decode()
- print(mac)
复制代码
有些网络环境是绑定了mac地址, 所在在连接前需要先得到mac地址绑定再进行连接.
nodemcu micropython 配置网络
- import network
- wlan = network.WLAN(network.STA_IF)
复制代码
nodemcu micropython 修改默认wifi密码和SSID
- import network
- ap = network.WLAN(network.AP_IF)
- ap.active()
- ap.config(essid=SSID NAME, authmode=network.AUTH_WPA_WPA2_PSK, password=PW) //改成自己的SSID和密码
复制代码
nodemcu micropython查看基本信息
- >>> import port_diag
- FlashROM:
- Flash ID: 15405e (Vendor: 5e Device: 4016)
- Flash bootloader data:
- Byte @2: 02
- Byte @3: 40 (Flash size: 4MB Flash freq: 40MHZ)
- Firmware checksum:
- size: 619812
- md5: 439fcc00468werwehtfyryh900c
- True
- Networking:
- STA ifconfig: ('192.168.1.14', '255.255.255.0', '192.168.1.1', '223.5.5.5')
- AP ifconfig: ('192.168.4.1', '255.255.255.0', '192.168.4.1', '223.5.5.5')
- Free WiFi driver buffers of type:
- 0: 8 (1,2 TX)
- 1: 0 (4 Mngmt TX(len: 0x41-0x100))
- 2: 8 (5 Mngmt TX (len: 0-0x40))
- 3: 4 (7)
- 4: 5 (8 RX)
- lwIP PCBs:
- Active PCB states:
- Listen PCB states:
- Local port 32, foreign port 1544 snd_nxt 107542608 rcv_nxt 10244896 State: LISTEN
- TIME-WAIT PCB states:
复制代码
|