Ii just gets stuck trying to connect:
Trying to connect. Note this may take a while…
So I can’t even get an IP address, or connect to it from any app.
I do use wireshark, but not sure what to do to monitor it trying to connect.
I modified the code to see if it was getting stuck doing something else (and basedf on what I read, tried to force it to use WPA2_PSK but your sample does not seem to require it.
Also tried to force it to use a static IP address. Neither DHCP or static IP work.
Setup Network Interface
network_if = network.WLAN(network.STA_IF)
network_if.active(True)
network_if.config(security=3) #WLAN.WPA2_PSK
wlan_mac = network_if.config(‘mac’)
security = network_if.config(‘security’)
print(‘MAC Address: {:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}’.format(wlan_mac[0],wlan_mac[1],wlan_mac[2],wlan_mac[3],wlan_mac[4],wlan_mac[5]))
print("Security: ", security ) # Show MAC for peering
if not network_if.isconnected():
print(‘Connecting to network…’)
network_if.ifconfig((‘192.168.1.71’, ‘255.255.255.0’, ‘192.168.1.250’,‘8.8.8.8’ ))
network_if.connect(‘XXXXX’,‘XXXXX’)
while not network_if.isconnected():
print(‘.’, end=‘\n’)
blue_led.on()
time.sleep(1)
blue_led.off()
red_led.on()
time.sleep(1)
red_led.off()
print(network_if.isconnected())
print(network_if.status())
print()
print(‘Connected:’, network_if.isconnected())
else:
print(‘Already connected!’)
I can see the LED changing from red to blue so it is in that loop, but no connection whatsoever.
Regards,
Ernesto