My summary of the situation as I observe things to be ...
Connect with a DHCP obtained address - Most use casesConnect with a Fixed IP - Without provoking a DHCP requestIncorrect way of connecting with a Fixed IP as it also provokes a DHCP requestIf just wanting to change the last octet to become a Fixed IP after DHCP
Connect with a DHCP obtained address - Most use cases
Code:
wlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.connect(ssid, password)while not wlan.isconnected(): passprint(wlan.ifconfig())Code:
wlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.ifconfig((ip, netmask, gateway, dns))wlan.connect(ssid, password)while not wlan.isconnected(): passprint(wlan.ifconfig())Code:
wlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.connect(ssid, password)while not wlan.isconnected(): passwlan.ifconfig((ip, netmask, gateway, dns))print(wlan.ifconfig())Code:
octet = ".199"wlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.connect(ssid, password)while not wlan.isconnected(): passip, netmask, gateway, dns = wlan.ifconfig()ip = ip[:ip.rfind(".")] + octetwlan.ifconfig((ip, netmask, gateway, dns))print(wlan.ifconfig())Statistics: Posted by hippy — Mon Jan 29, 2024 12:02 pm