I've tried the MicroPython code on page 36 of the Pico 1 document but it doesn't connect. Here's the code:
import time
import network
ssid = 'BT-JJAC9T'
password = 'xxxxxxxxx'
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(ssid, password)
# Wait for connect or fail
max_wait = 10
while max_wait > 0:
if wlan.status() < 0 or wlan.status() >= 3:
break
max_wait -= 1
print('waiting for connection...')
time.sleep(1)
# Handle connection error
if wlan.status() != 3:
raise RuntimeError('network connection failed')
else:
print('connected')
status = wlan.ifconfig()
print( 'ip = ' + status[0] )
I copied/pasted it into Thonny and edited out the line numbers. I've hidden the password. My tabs seem to have vanished in the listing above.
I get Unable to connect to COM38: port not found
Has anyone else got it to work?
import time
import network
ssid = 'BT-JJAC9T'
password = 'xxxxxxxxx'
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(ssid, password)
# Wait for connect or fail
max_wait = 10
while max_wait > 0:
if wlan.status() < 0 or wlan.status() >= 3:
break
max_wait -= 1
print('waiting for connection...')
time.sleep(1)
# Handle connection error
if wlan.status() != 3:
raise RuntimeError('network connection failed')
else:
print('connected')
status = wlan.ifconfig()
print( 'ip = ' + status[0] )
I copied/pasted it into Thonny and edited out the line numbers. I've hidden the password. My tabs seem to have vanished in the listing above.
I get Unable to connect to COM38: port not found
Has anyone else got it to work?
Statistics: Posted by leon_heller — Wed Nov 27, 2024 11:25 am