Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4760

General • Connecting to home network with PicoW

$
0
0
Hello,

I'm trying to connect my pico to my wifi AP, using boilerplate code taken from here: https://projects.raspberrypi.org/en/pro ... d-pico-w/2 (see below) but with no joy, I simply get endless "waiting for connection" output.

Code:

import networkimport socketfrom time import sleepimport machinessid = 'wifiAP'password = 'pass'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)    print(wlan.ifconfig())try:    connect()except KeyboardInterrupt:    machine.reset()
while logged into my access point I see the Pico appear that some data is sent – I presume the IP via DHCP – and then the pico disappears. I made a note of the MAC address and added it to my router assigning a static IP. Same problem.

When I run a network scan on the pico

Code:

import networkwlan=network.WLAN(network.STA_IF)wlan.active(True)access_points = wlan.scan()for AP in access_points:        print(AP)
the access point shows up and I know the PW is correct.

When I run a hotspot on my phone, the pico connects straight away. Total headscratcher.

Anyone else come accross this issue and resolved it? I found a closed thread from last year but can't ask the OP if they found a resolution or not.

Statistics: Posted by deebz — Fri Mar 15, 2024 6:23 pm — Replies 0 — Views 21



Viewing all articles
Browse latest Browse all 4760

Trending Articles