I just put my hands on RP Pico W to try it out but I hit the issue with the very first wifi test. Tutorials say to do this:
import network
import socket
from time import sleep
from picozero import pico_temp_sensor, pico_led
import machine
因此,当我进口所有必需的包裹时,我 p切的镜子就认为了这一点:
然而,在尝试像这样的休克时:
def connect():
#Connect to WLAN
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(ssid, password)
while wlan.isconnected() == False:
print( Waiting for connection... )
sleep(1)
ip = wlan.ifconfig()[0]
print(f Connected on {ip} )
try:
connect()
except KeyboardInterrupt:
machine.reset()
它没有以下错误:
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lib/network.py", line 8, in <module>
File "/lib/socket.py", line 42, in <module>
AttributeError: module object has no attribute socket
>>>
This is whole code, I skipped only ssid and password.
我不能说什么是错的。 我没有任何其他档案,其名称与目录相同。
I took the example from RP foundation pages: https://projects.raspberrypi.org/en/projects/get-started-pico-w/2