English 中文(简体)
Raspberry Pico 世界网络测试失败
原标题:Raspberry Pico W network test fails

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切的镜子就认为了这一点:

“entergraph

然而,在尝试像这样的休克时:

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

问题回答

如果你只想测试连接无线电话,你就能够评论化妆品进口。 它为我工作。 以下是产出。

//from picozero import pico_temp_sensor, pico_led


MicroPython v1.22.0 on 2023-12-27; Raspberry Pi Pico W with RP2040
Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
Waiting for connection...
Waiting for connection...
Waiting for connection...
Connected on 192.168.0.219
>>> 




相关问题
Convert byte string in Micropython

As noted here receiving a message through a Micropython socket results in being left with a byte string to work with. My question is how to convert this byte string to another usable format? I have ...

RP Pico won t connect to PC

I created a blink program with cmake in a VM and loaded it onto the pico from Windows. The pico disconnected, but it did not blink, and it does not reconnect to my windows pc. I tried unplugging it ...

Micropython remove cr/lf on pico w

I m pretty new to python and don t have a handle on the string functions yet. I want to have a simple TCP server I can enter commands into and have the network part working, but I can t figure out ...

热门标签