Hello! I got a new Raspberry Pi pico w and was trying to connect it to wi-fi. When I tried connecting, it was waiting forever. So, I tried troubleshooting the issue and discovered that sta_if.active(true) and ap.active(true) aren't working. It would be great if anyone could help. I'll share the code and output as well.
Output: >>> %Run -c $EDITOR_CONTENT
MPY: soft reboot
[CYW43] F2 not ready
STA mode activated: False
>>>Output: Connecting to your wifi...
connecting to network...
test 1
['__class__', 'IF_AP', 'IF_STA', 'PM_NONE', 'PM_PERFORMANCE', 'PM_POWERSAVE', 'SEC_OPEN', 'SEC_WPA_WPA2', 'active', 'config', 'connect', 'deinit', 'disconnect', 'ifconfig', 'ioctl', 'ipconfig', 'isconnected', 'scan', 'send_ethernet', 'status']
0
0
0
test 2
test 3
('0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0')
function takes 3 positional arguments but 1 were given
Code:
import networkimport timesta = network.WLAN(network.STA_IF)sta.active(True)print("STA mode activated:", sta.active())
MPY: soft reboot
[CYW43] F2 not ready
STA mode activated: False
>>>
Code:
import networkSSID = "SSId"SSI_PASSWORD = "Psswd"def do_connect(): import network sta_if = network.WLAN(network.STA_IF) wlans = [network.WLAN(w) for w in (network.STA_IF, network.AP_IF)] sta_if, ap_if = wlans if not sta_if.isconnected(): print('connecting to network...') try: print("test 1") print(dir(sta_if)) print(ap_if.status()) #ap_if.active(True) print(ap_if.status()) print(sta_if.status()) print("test 2") sta_if.active(False) print("test 3") print(sta_if.ifconfig()) print(sta_if.ioctl()) sta_if.active(True) print(sta_if.active()) print(sta_if.ifconfig()) print(sta_if.status()) print(sta_if.scan()) print("test") sta_if.connect(SSID, SSI_PASSWORD) except Exception as e: print(e) while not sta_if.isconnected(): pass print('Connected! Network config:', sta_if.ifconfig()) print("Connecting to your wifi...")do_connect()
connecting to network...
test 1
['__class__', 'IF_AP', 'IF_STA', 'PM_NONE', 'PM_PERFORMANCE', 'PM_POWERSAVE', 'SEC_OPEN', 'SEC_WPA_WPA2', 'active', 'config', 'connect', 'deinit', 'disconnect', 'ifconfig', 'ioctl', 'ipconfig', 'isconnected', 'scan', 'send_ethernet', 'status']
0
0
0
test 2
test 3
('0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0')
function takes 3 positional arguments but 1 were given
Statistics: Posted by Shloka Shah — Tue Nov 05, 2024 8:43 pm